Subject: | |
From: | |
Reply To: | |
Date: | Wed, 6 May 1998 08:43:26 +8 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> Since everyone is taking advantage of this opportunity for some additional
> requests how about one more:
>
> I'd like a function that would return a random string of alternating
> constants and vowels (similar to MPEX). I would use it to secure MPE
> users that were left without passwords.
> altuser user.account;pass=![randomname()]
Ok, it's ugly as homemade sin (my southern roots are showing again), but
these two command files may do the trick for you (if you aren't in a hurry):
First, we have a command file named RANDOMN (for RANDOM Number), that
generates a random integer within a specified range. The result is stored in
the variable "random_number":
------------------
parm ran_min=0 ran_max=999999999
comment --- SETVAR RANDOM_NUMBER to a random number
setvar random_number -1
setvar max_digits len("!ran_max")
while random_number<!ran_min or random_number>!ran_max
setvar s rht("!hpcpumsecs",1)
setvar digits max(!s,1)
setvar digits min(digits,max_digits)
setvar random_number_s ""
while digits>0
setvar digits digits-1
setvar random_number_s random_number_s + rht("!hpcpumsecs",1)
endwhile
setvar random_number !random_number_s
endwhile
------------------
Next, a command file named RANNAME that generates a random MPE filename
(luckily for you, the same rules apply to MPE filenames and MPE passwords).
The result is stored in "RANDOM_FILENAME".
------------------
randomn 1,8
setvar filename_len random_number
setvar random_filename ""
while filename_len > 0
randomn ![ord("A")], ![ord("Z")]
setvar random_filename random_filename+chr(random_number)
setvar filename_len filename_len - 1
endwhile
------------------
Now just:
:ranname
:altuser user.account;pass=!random_filename
This is just a start. Modifying it to alternate consonents and vowels is
left as an exercise for the reader. Also, it doesn't appear to be quite as
random as I would like, but I think it will still serve your purpose.
Have fun!
---
Michael D. Hensley | mailto:[log in to unmask]
Allegro Consultants Inc. |
408/252-2330 | Visit scenic http://www.allegro.com
|
|
|