Re: Cryptographically secure random number generation
Posted: Thu Mar 22, 2012 2:37 am
I don't state that times itself is a good source of seed. Of course, this is VERY bad source. But nevertheless, in combination with other sources it makes seed less predictable for remote attack, when the hacker has no direct physical access to your PC. Especially it concerns RDTSC since this counter changes very quickly. BIOS timer combined with reading the PIT counter snapshot may be used as substitution for an old systems without RDTSC instruction support (486/386).Rudster816 wrote:Times is an excellent source of seeds for PRNGs, but has no business as a seed for cryptography because it's guessed way too easily.
Actually DRAM is not zeroed. It is filled with almost regular patterns (with some kind of physical fluctuations), but not with zeroes. The actual pattern and amount of fluctuations highly depends on memory ICs used. Also there are areas (interrupt vector table, BIOS data areas and the MB/VGA BIOSes itself) which are less predictable for remote attacker.Rudster816 wrote:So long as a computer is off for a sufficient amount of time, all DRAM will be zero'd out on power up, so junk in memory can easily be reproduced reliably.
I suspect that you don't comprehend the work of cryptographical mechanisms well enough. The strength of algorithm means much more that just strength against decrypting the output. One of the most valuable criterion of strength is the standing against the following attack...Rudster816 wrote:Also, I don't think using AES to as an RNG is a very good idea. Since encryption by it nature is reversible, if one were to know the key, you could trivially work out the seed based on a random number given from the given RNG.
Suppose that an attacker has an unlimited access both to source data and to encrypted ones. In this case attacker must not have possibily to reconstruct the key used for encryption. AES is strong enough against this attack.
So, the reversability of encryption process means nothing in terms of RNG quality.
Probably SHA256 should work well enough, but you don't take into account the full set of features which the good source of random numbers must have. Full set means not only unpredictability. It must include linearity of distribution. As for the SHA and MD hashes, they provide irreversibility of the gained value, but not guarantee the distribtion linearity. That's why RNG based on SHA should be used with some care for scientific physical modelling. The AES due to it's reversability ensures distribution linearity for algorithm that I described. The only drawback of algorithm is that for full cycle on source counter you'll get exactly linear distribution, which is unfair for the true random numbers. But since you get large enough source counter (128 bit) you'll not be able to detect that pecularity.Rudster816 wrote:A better method would be to use a good hash function (e.g. SHA256), but I think a proven PRNG algorithm would be the best choice.
The same argumentation is also suitable for quantum random generators. Even if the predictability of values is beyond doubts, the linearity is arguable.
Actually not entirely. The difficulty is to mathematically prove the strength of basic algorithm against a known (very limited) set of possible attacks. But since you rely on strength of basic algorithm, you may provide theoretically strong derivative algorithms.Rudster816 wrote:Making anything secure from a sophisticated attack is very difficult even for experts (just look at WEP).
But nevertheless, SHA256 is good for generating session key for AES RNG. I forgot to mention it in RNG algorithm description. Add the following step:
0. Take seed and make SHA or MD hash of it. Use the result value as session key for the following AES algorithm.