|
|
![]() |
||||
|
|
|
|
|
|
One can make a strong random number generator with this system by modifying the XOR part of the encryption process and storing just using the XOR value as the random number. The guts would look something like this : type ... function GetRandom : byte;
SwapByte( Seed.State[ Seed.x ] , Seed.State[ Seed.y ] ); GetRandom := Seed.State[ Seed.State[
Seed.x ] + Seed.State[ Seed.y ] ]; The trick is getting the whole thing started (i.e. seeding the generator). The best way to do this is feeding in 256 "real-world" random bytes (2048-bits). These may come from things such as delay time between keystrokes or mouse movement. Then, the standard init may look something like this : procedure InitRandom( const
RandomStream : array of byte ); { Initial
256 byte matrix with each element set to it's index } { Modify
matrix } If the predictions on the RC4 algorithm are correct, this should create a generator with a period greated than 10**100. The seed would could be saved directly to disk after each use so the stream can be restarted. To stop traceing of the generators last stream, the generator could be reseeded with a random stream before being saved, like this : procedure Reseed;
InitRandom( RandomStream );
Sence the 'RandomStream' acts like the key does for normal RC4 operations, there's no way to the new stream back to 'RandomStream', which means there's no way to trace the new seed back to the old seed. This is nessary in generators used for creating public/private keys sets. |