Edited appendix-bitcoin-fundamentals-review.asciidoc with Atlas code editor

pull/910/head
kristen@oreilly.com 3 years ago
parent 2af303f806
commit a94e02b628

@ -54,7 +54,7 @@ A hash function, also known as a _digest function_, is a function that takes arb
image::images/mtln_aa01.png["The SHA-256 cryptographic hash algorithm"]
For example, if we use a command-line terminal to feed the text "Mastering the Lightning Network" into the SHA256 function, it will produce a fingerprint as follows:
For example, if we use a command-line terminal to feed the text "Mastering the Lightning Network" into the SHA-256 function, it will produce a fingerprint as follows:
----
$ echo -n "Mastering the Lightning Network" | shasum -a 256
@ -75,7 +75,7 @@ $ cat bitcoin.pdf | shasum -a 256
b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553 -
----
While it takes longer than a single sentence, the SHA256 function processes the 9-page PDF, "digesting" it into a 256-bit fingerprint.
While it takes longer than a single sentence, the SHA-256 function processes the 9-page PDF, "digesting" it into a 256-bit fingerprint.
Now at this point you might be wondering how it is possible for a function that digests data of unlimited size to produce a unique fingerprint that is a fixed-size number?
@ -332,7 +332,7 @@ To demonstrate this, let's have Bob generate a random number +R+ and keep it sec
R = 1833462189
----
Now, Bob calculates the SHA256 hash of this number:
Now, Bob calculates the SHA-256 hash of this number:
----
H = SHA256(R) =>
@ -352,7 +352,7 @@ where +H+ is the actual hash value (+0ffd8...036a+) that Bob gave to Alice.
Let's explain this script:
The HASH256 operator pops a value from the stack and calculates the SHA256 hash of that value. Then it pushes the result onto the stack.
The HASH256 operator pops a value from the stack and calculates the SHA-256 hash of that value. Then it pushes the result onto the stack.
The +H+ value is pushed onto the stack, and then the +EQUAL+ operator checks if the two values are the same and pushes +TRUE+ or +FALSE+ onto the stack accordingly.

Loading…
Cancel
Save