Main Programs
Writings
Algorithms
Contact

 Using existing algorithms to create random data
Using encryption algorithms for random number generators:
Encryption algorithms, by their nature, are a great source of random data.  If the algorithm is any good at all, the output will, by itself, appear to be complexly random.  If predictions can be make about the output of an algorithm, it means that algorithm is probably vulnerable to attack other than brute force.
Encryption algorithms can be applied to random number generators by using what supply of "true random data" we have to initialize the algorithm.  From that point on, it is by nature of the algorithm to continue to generate unpredictable data.
We can use either block ciphers or stream ciphers in our random number generator system.  Block ciphers have to be used in streaming mode, such as Cipher Block Chaining (CBC).
To start the generator, real-world random data must be acquired-- enough bits to act as the key to the cipher.  Then, the cipher is initialized with this random key as the key.
When random data is needed, simply cipher a block of data.  It matters not what is in the block before being ciphered.  After encryption, the block be filled with random data.

Using message digest algorithms as random number generators:
A message digest algorithm can be used as a stream cipher and therefore, also be used to an a random number generator in a similar way.

Here is one to use a message digest algorithm for encryption
Initialization:
Key -> Digest -> State

Encryption:
OutputData = InputData xor State
State = State -> Digest

Basically, the message digest runs in a feedback mode.  Each time data is encrypted, that state is digested and the hash output is used for the next state.  The data to be encrypted is XORed by the state to create the ciphered text.  To retrieve the original data, the process is applied again.  In this mode, the message digest is independent of the input data, but the pros and cons of that will not be discussed here.  This fact does help us in making a random number generator.
To convert the system to generate random numbers, the key initialization stays the same.  Now to generate random data, we have this instead:
State = State -> Digest
RandomData = State

Depending on the block size, the above may have to loop until and add data until the requested amount of random data has been produced.  In any case, the initial input into the algorithm determines what will come out after that point.
In what ever system used, the initial input is the key to how strong the random numbers generated are.  If the initializing state can be guessed, predicted or recovered, the random data stream can be reproduced-- which is a bad thing.