4

The first answer here does a good job explaining how the SHA-256 function requires more than one input (an initial one is specified by to the SHA-256 specs). As far as I understand it, the "midstate" value is the initial hash of the first half of the data, used to later serve as an input into the double-hash of the second half of the data.

Is this correct?

And here is an explanation of what the "hash1" value actually is and means, but what is it used for?

ConstableJoe
  • 655
  • 2
  • 7
  • 14
  • What do you mean by "half" here? If `b=SHA(a=SHA(data))`, a = "initial hash" and b = "second half"? So, `a` is the midstate? – Geremia Mar 27 '15 at 04:15
  • [This](https://crypto.stackexchange.com/a/1884/6733) defines midstate well; it's "the contents of the 'state' after having processed the first [SHA256] block." Thus, it's not `a` in `b=SHA(a=SHA(data))` if `data` is longer than one SHA256 block (64 bytes). Isn't the Bitcoin block header 80 bytes? – Geremia Jun 11 '15 at 06:21

1 Answers1

2

1) Yes, it is correct.

2) It is deprecated. Generally, it is used to write the result of the mining over to be sent to the pool. This is to ensure the result is of correct length and adheres to some rules. In practice, it is always the same trailing string of numbers.

ThePiachu
  • 42,931
  • 25
  • 138
  • 347