Talk:Base58Check encoding: Difference between revisions

(added a talk (discussion) section.)
 
Line 7:
 
-----
 
== Code examples are NOT Base58Check. ==
 
They are more normal Base58 examples. Base58Check INCLUDES setting a version byte BEFORE anything else, double-SHA256-ing the concatenated hex string and putting the first 4 bytes of the result behind the hex string, then convert the whole thing to Base58.<br /><br />
For example:<br />
Let the input be following hex: 000102030405060708090a0b0c0d0e0f<br />
Put a version byte before it, for example 80. You get '''80'''000102030405060708090a0b0c0d0e0f<br />
Now do a SHA256. You get 4d00ec9820c958f2d198ccc75f6682f7876228eea3ca3bd68c851302438151cb<br />
Now do another SHA256 of the previous SHA256 result. You get 5ffc3b4fca2a220cc9c19c41dfd7248af608f50b188efcbbfa2ae3df96643ad0<br />
Now take the first 4 bytes from this and append them to the hex with the version byte as following: 80000102030405060708090a0b0c0d0e0f'''5ffc3b4f'''<br />
This will now be converted to Base58: 8sWmykwPRCRjGtuBczJSJTysdzuaW<br /><br />
This is the whole Base58Check process. It actually works with any hex of any length.<br />
In case of Bitcoin, those hex strings are 32 bytes for private keys and 20 bytes for addresses (not public keys). Also, version bytes are 80 for private keys and 00 for addresses. Every leading 00 must be denoted with an 1 in the Base58 string. -- [[User:Stl1988|Stl1988]] ([[User talk:Stl1988|talk]]) 07:28, 11 December 2018 (UTC)
5

edits