google-code-export / candydolldb

Automatically exported from code.google.com/p/candydolldb
0 stars 0 forks source link

Outputlength of GenerateGarbage not constant #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. On user_view.php, request an automatically generated password
2. Keep on requesting such passwords
3. Notice that, over time, the length of the password varies from 8-10

What is the expected output? What do you see instead?
An automatically generated string of constant length (10).

Original issue reported on code.google.com by fwp...@gmail.com on 20 Oct 2012 at 9:23

GoogleCodeExporter commented 9 years ago
Have tested the GenerateGarbage() function in a for-loop, repeated it about 
10-20 times. If you echo or var_dump() the output, you can clearly see the 
difference in output length.

Original comment by fwp...@gmail.com on 20 Oct 2012 at 9:24

GoogleCodeExporter commented 9 years ago
Tested it in a for-loop once more. This time with increasing length, to see 
whether the length discrepancy grows: it does.

When generating a random string of 10 characters long, the output varies in 
length 0-2 characters.

When generating a random string of 50 characters long, the output varies in 
length 0-5 characters.

When generating a random string of 160 characters long, the output varies in 
length 0-9 characters.

Original comment by fwp...@gmail.com on 22 Oct 2012 at 5:55

GoogleCodeExporter commented 9 years ago
When generating a random string of 1000 characters long, the output varies in 
length 8-29 characters. Not one of them is actually the desired 1000 chars long.

Original comment by fwp...@gmail.com on 22 Oct 2012 at 5:59

GoogleCodeExporter commented 9 years ago
Note to self: substr(x,y,z) expects two indexes and a length, rand(x,y) gives a 
value between x and y  inclusive... I forgot to subtract 1 from 
$CharsToChooseFromLength... D'oh!

Original comment by fwp...@gmail.com on 22 Oct 2012 at 6:19