Post
Topic
Board Development & Technical Discussion
Re: A sha256 digest and a private key
by
pooya87
on 30/10/2021, 03:40:03 UTC
putting some text through the Sha256 algorithm produced a 256 character string of ones and zeroes.  If that correct. If so how do we them get the digest?
Hash algorithms such as SHA256 doesn't produce characters, they produce bits (which is the zeros and ones) with a fixed length. Then you can encode those bits using any form of encoding you like. The most common one is base16 or hexadecimal which is why you end up with alphanumerical characters between 0-9 and a-f.

If I generate a sha256 digest from some text I get one string of letters and numbers, but if I generate a key pair using bitaddress, using the same text I get a private key.
What is the relationship between the digest and the private key?
The reverse is the same. You can decode those alphanumerical characters (base16 or whatever else) to get the bits and then interpret those bits however you like. In bitaddress.org when you enter 256-bit hexadecimal you are interpreting it as a 256-bit number between 1 and secp256k1 order (n) or in other words a bitcoin private key.