Random algorithm

Mark Brownell gizmotron at earthlink.net
Thu Nov 13 00:21:39 EST 2008


random(upperLimit - lowerLimit + 1) + lowerLimit - 1

Gads, I've given myself a headache. The Vegas stuff is interesting. The modern RNGs are safe up to a half a million spins for their one armed bandits. After that an attack can find repeats of the random sequences. Before they fixed it they were hacked from the inside by their own people and that was when they had to improve things. And that is where we are now with RNGs. Any sequence that starts from some unknown random seed will not have discernible repeats before 500,000 unique numbers generated.

For my Blowfish CBC I use any number from 1 to 255, sixteen times to produce the first 16 characters to be encrypted. Then they are used to encrypt the next 16 characters to be encrypted.

I could set the seed for each of those first 16 characters. That would be almost bomb proof for a brute force attack.

put random(10000000 - 1000000 + 1) + (1000000 - 1) into hNewRandomSeed
set the randomSeed to hNewRandomSeed
put random(hNewRandomSeed - 1000000 + 1) + (1000000 - 1) into hNewRandomSeed
set the randomSeed to hNewRandomSeed
put random(hNewRandomSeed - 1000000 + 1) + (1000000 - 1) into hNewRandomSeed
set the randomSeed to hNewRandomSeed
put random(hNewRandomSeed - 1000000 + 1) + (1000000 - 1) into hNewRandomSeed
put random(38) into nextSpin

What a lively discussion.



More information about the use-livecode mailing list