hash1 is a uint256 zero, padded to a multiple of 64 bytes by FormatHashBlocks() in main.cpp, and then reversed in 4 byte chunks.
FormatHashBlocks() puts a 0x80 right after the 32 zero bytes, and a 4 byte bit count at the end (00 00 01 00, meaning 256 bits).
the uint256 zero is:
0000000000000000 0000000000000000 0000000000000000 0000000000000000
it's padded to 64 bytes:
0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
has the 80 in the first byte of padding:
0000000000000000 0000000000000000 0000000000000000 0000000000000000 8000000000000000 0000000000000000 0000000000000000 0000000000000000
^^
and the length at the end:
0000000000000000 0000000000000000 0000000000000000 0000000000000000 8000000000000000 0000000000000000 0000000000000000 0000000000000100
^^^^^^^^
and then has each group of 4 bytes reversed: 12 34 56 78 -> 78 56 34 12
0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000008000000000 0000000000000000 0000000000000000 0000000000010000
^^^^^^^^ ^^^^^^^^
A better question might be "why is hash1's value calculated like this"?
You didn't ask, but the data
field returned by getwork
is formatted the same way. Instead of a uint256 zero though, the input is:
- version (4 bytes)
- previous block's hash (32 bytes)
- merkle root (32 bytes)
- time (4 bytes)
- bits (related to difficulty) (4 bytes)
- nonce (4 bytes)
That's a total of 80 bytes, which is padded to 128 bytes by FormatHashBlocks().
Example:
00000001 (version)
0863bcb701d52fea 0e0c7b0d4696d7e7 8feb125a84e0911b 0000043e00000000 (prev hash)
bc656fe91e44907c 32d1704f900bd7a6 c2fa06386174477f a8b145addebc8d00 (merkle root)
4f35dde3 (time)
1a0c290b (bits)
00000000 (nonce)
0000008000000000 0000000000000000 0000000000000000 } (padding)
0000000000000000 0000000000000000 0000000080020000 } (80 bytes = 640 bits = 0x280)