Skip to content

Commit a95118a

Browse files
authored
Update README.md
1 parent c1cbc7b commit a95118a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1032,19 +1032,20 @@ In theory calculating the block hash is as easy as:
10321032
## pseudo-code
10331033
header = "..." # 80 bytes (binary)
10341034
d1 = sha256( header )
1035-
d2 = sha256( d2 )
1035+
d2 = sha256( d1 )
10361036
d2.to_s # convert 32-byte (256-bit) binary to hex string
10371037
#=> "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
10381038
```
10391039

10401040
Note: Classic bitcoin uses a double hash, that is,
1041-
for even higher security the hash gets hashed twice with the SHA256 algorithm.
1041+
for even higher security the hash gets hashed twice with the SHA256 algorithm
1042+
e.g. `sha256(sha256(header))`.
10421043

10431044
In practice let's deal with the different byte order conversions
10441045
from big endian (most significant bit first)
10451046
to little endian (least significant bit first) and back again.
10461047

1047-
Tip: Read more @ [Endianness @ Wikipedia](https://en.wikipedia.org/wiki/Endianness).
1048+
Tip: Read more about [Endianness @ Wikipedia](https://en.wikipedia.org/wiki/Endianness).
10481049

10491050

10501051
Let's put together the (binary) 80-byte header using the

0 commit comments

Comments
 (0)