<div dir="ltr">On Aug 10, 2014 6:45 AM, "Devin Jeanpierre" <<a href="mailto:jeanpierreda@gmail.com">jeanpierreda@gmail.com</a>> wrote:<br>> > * Uses SystemRandom class (if available, or falls back to Random)<br>
><br>> This sounds cryptographically weak. Isn't the normal thing to do to<br>> use a cryptographic hash function to generate a pseudorandom sequence?<br><br>You mean in the fallback case, right? I'm no crypto expert, but I've never heard of SystemRandom being contra-recommended for crypto, and even the Python docs recommend it.<br>
<br>The output of even a cryptographically strong hash isn't going to have any more entropy than the input, so if the input is predictable then the output will be also. One approach I'm aware of, which is used by Django, is to hash the RNG state along with the time and a local secret In order to reseed the RNG unpredictably whenever randomness is required. That creates a configuration burden in order to establish the secret, though.</div>