Page 2 of 2 <12
Topic Options
#70924 - 2003-01-31 04:21 PM Re: Creating random Passwords
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Is there maybe a bug in RND in 4.20? When I run the above mentioned code at NT/2000 Strong Password Generator, I get the following ouput...

y-mA[XG;+x0
D3llg%F&Bl0
D3llg%F&Bl0
D3llg%F&Bl0
D3llg%F&Bl0
RD/`Gi.(,%0
RD/`Gi.(,%0
RD/`Gi.(,%0
RD/`Gi.(,%0
RDvE'-)cGO0
d+vE'-)cGO0
d+vE'-)cGO0
d+vE'-)cGO0
d+vE'-WSJ>0
G8i+*qWSJ>0
G8i+*qWSJ>0
G8i+*qWSJ>0
G8i+*qWS(_0
)?A+~5l6(_0
)?A+~5l6(_0
)?A+~5l6(_0
)?A+~5l6?S0
wW1uSyEe?S0
wW1uSyEe?S0
wW1uSyEe?S0
wW1uSyEe?S0
qyD@(=uddG0
qyD@(=uddG0
qyD@(=uddG0
qyD@(=uddG0
^3^}O{VM]_0
^3^}O{VM]_0
^3^}O{VM]_0
^3^}O{VM0=0
^KJOPF40=d0
^KJOPF40=d0
^KJOPF40=d0
^KJOPF40=d0
.2.e?%_O{]0
.2.e?%_O{]0
.2.e?%_O{]0
.2.e?%_B.F0
^[D?yNB.Fz0
^[D?yNB.Fz0
^[D?yN'$+C0
lf[0"L'$+C0
lf[0"L'$+C0
lf[0"L'$+C0
lf[0"L'$+C0
l%m(]ZoAW~

Not very random...

[ 31. January 2003, 16:23: Message edited by: CitrixMan ]

Top
#70925 - 2003-01-31 04:35 PM Re: Creating random Passwords
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Are you seeding the random number generator? Check SRND()
_________________________
There are two types of vessels, submarines and targets.

Top
#70926 - 2003-01-31 06:48 PM Re: Creating random Passwords
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
This is the code...I did not write it but it appears to me that it is.

code:
 
for $i = 1 to 50 ;modify how many you want to generate.
? pword(10)
next

function Pword($length)
dim $seed, $length, $i, $chr

$seed = 5000
$seedjump = 1000
$length = val($length)

for $i = 1 to $length
$chr = random(33,126,$seed) $seed = $seed - $seedjump
select
case $i = 1
while $chr >= 48 and $chr <=57
$chr = random(33,126,$seed) $seed = $seed + $seedjump
loop
case $i = $length
while $chr >= 48 and $chr <=57
$chr = random(33,126,$seed) $seed = $seed - $seedjump
loop
endselect
$pword = $pword + chr($chr)
next
endfunction


function random($min, $max, optional $seed)
DIM $i, $burn, $nul
srnd((-1)*@ticks*(val($seed)+1))
$burn = rnd(50)
for $i = 1 to $burn
$nul = rnd($max)
next
$random = rnd($max)
while $random < $min or $random > $max
$random = rnd($max)
loop
endfunction

get $



[ 31. January 2003, 18:50: Message edited by: CitrixMan ]

Top
#70927 - 2003-01-31 06:51 PM Re: Creating random Passwords
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Maybe I should put this into a new thread?
Top
#70928 - 2003-01-31 07:34 PM Re: Creating random Passwords
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
hmmm interesting....

playing with it right now....

Top
#70929 - 2003-01-31 07:43 PM Re: Creating random Passwords
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
ahhh i see what is going on!!

4.20 is just to damn fast!!

I wrote this code with 4.12 in mind.... At the time i was not wanting to create a global $seed variable, and was wanting to keep everything contained inside the UDF's.... that is why there is this.



    for $i = 1 to $burn
        $nul = rnd($max)
    next



in my random UDF.... looks like either going to have to set the srnd() from outside the udf's.... or jsut use a global $seed variable.

hmmm i have a few ideas.... on a way of not having to use srnd or a global $seed.....

Top
#70930 - 2003-02-08 07:56 AM Re: Creating random Passwords
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Shane.. I can confirm that the code no longer functions as expected anymore using v4.20

I retested with v4.12 and it does work as before.

I'll have to post this into the beta forum I guess. I think it is a timing issue in that I think that 4.20 is even faster and maybe the time slice is not quick enough, so you now see duplicates.

Top
#70931 - 2003-02-08 07:59 AM Re: Creating random Passwords
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
I see Bryce answered as well already.

Not sure that it is a BUG, as Bryce says, it may just need to be re-coded to handle the speed.

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.057 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org