Post
Topic
Board Development & Technical Discussion
Re: Isn't the output of SHA256 *slightly* too big to use for a private key?
by
plaprade
on 09/10/2013, 19:14:35 UTC
If the output of the SHA256 is greater than n it will just "wrap around" and work.

Although, now that I think about it, if the output of your SHA256 was exactly n that would probably cause a problem.

But then, the probablity of the output of the SHA256 being exactly n is 1 / 2256

You should not "wrap around" or reduce your integer modulo n.

If your integer is == 0 or or >= n, then you should discard it completely and generate a new private key using a new secret. Otherwise you would be introducing a bias towards lower-valued private keys.