Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Would merely repeating the same value 8 times be sufficient ? Or is there a more clever approach for doing this ? The 256 bit values would be generated from SHA256 of files.

share|cite|improve this question
use it to see a cryptographic random number generator. – user58512 Mar 9 '13 at 14:27
I think this is the best approach yes. I found… which seems to do something pretty close to that. – xander Mar 9 '13 at 16:43

Random numbers for cryptography are a tough subject because you need true random numbers and that is a difficult subject!

However, the method you are suggesting is not sufficient whatsoever for cryptographic purposes.

You should have a look at the NIST Recommendation for Random Number Generation Using Deterministic Random Bit Generators.

Also, you might want to have a look at the "Handbook of Applied Cryptography".

Lastly, you might want to learn about DIEHARDER and TESTU01 for testing the quality of your random bits as you need high entropy source.

If this is for non-crypto purpose, you might want to use Keccak - SHA3 to extend the number of bits.


share|cite|improve this answer
Thank you so much for your recommendations. I can't use Keccak I think, because there isn't a ready-made Microsoft C# implementation yet. I ended up using… giving it the SHA256/SHA512 hash, and getting back 256 random bytes (2048 bits). – xander Mar 9 '13 at 16:45
This needs more thumbs up! got one from me ;-) – amWhy Apr 23 '13 at 0:18
True RNG is a very tricky business and is a really hard area! Thx – Amzoti Apr 23 '13 at 0:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.