|
|
![]() |
||||
|
|
|
|
|
|
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: Here is one to use a message digest algorithm for encryption Encryption: 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. 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.
|