1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-12-23 15:18:11 +00:00

ch4 fix equations 2

This commit is contained in:
Andreas M. Antonopoulos 2014-03-01 23:47:46 -08:00
parent d17dd94ca7
commit 7fa9a63048

View File

@ -24,7 +24,7 @@ In the most simple form, the +private key+ is a number. The private key be used
===== Generating a private key from a random number
A private key is a number, between +1+ and +n - 1+ where latexmath:[\(n ~= 1.158 * 10^77\)] is the order of the elliptic curve used in bitcoin (See <<secp256k1>>). To create such a key, we just pick a 256-bit random number, and check that it is less than +n - 1+, or pick another random number and check again, until we get one less than +n - 1+. The constant +n+ is defined in any elliptic curve cryptography library. In programming terms, this is usually achieved by feeding a larger string of random bits, collected from a cryptographically-secure source of randomness, into the SHA-256 hash algorithm which will conveniently produce a 256-bit number.
A private key is a number, between +1+ and +n - 1+ where latexmath:[\(n = 1.158 * 10^\(77\) \)] is the order of the elliptic curve used in bitcoin (See <<secp256k1>>). To create such a key, we just pick a 256-bit random number, and check that it is less than +n - 1+. The constant +n+ is defined in any elliptic curve cryptography library. In programming terms, this is usually achieved by feeding a larger string of random bits, collected from a cryptographically-secure source of randomness, into the SHA-256 hash algorithm which will conveniently produce a 256-bit number.
[TIP]
@ -116,7 +116,7 @@ y = 7A 3D 41 E6 70 ... CD 90 C2
Here's the same public key shown as a 512-bit number (130 hex digits) with the prefix +04+ followed by +x+ and then +y+
.Uncompressed Public Key K shown in hex as +04 x y+
.Uncompressed Public Key K shown in hex (130 hex digits) as +04 x y+
----
K = 04 32 5D 52 E3 B7 ... CD 90 C2
----
@ -125,7 +125,7 @@ The +y+ coordinate can be deduced from the +x+ coordinate, since they both lie o
Here's the same public key above, shown as a +compressed public key+ stored in 264-bits (66 hex digits) with the prefix +02+ indicating the +y+ coordinate has a positive sign:
.Compressed Public Key K shown in hex as +K = {02 or 03} x+
.Compressed Public Key K shown in hex (66 hex digits) as +K = {02 or 03} x+
----
K = 02 32 5D 52 E3 B7 ... E5 D3 78
----