0

I'm trying to understand Bitcoin protocol, and sometimes see instructions like this:

The TransactionId is defined by SHA256(SHA256(txbytes))

or

The hash of the public key is generated by performing a SHA256 hash on the public key, and then performing a RIPEMD160 hash on the result, with Big Endian notation. The function could look like this: RIPEMD160(SHA256(pubkey))

For what purpose do hash calculatig twice?

Timur Lemeshko
  • 2,747
  • 5
  • 27
  • 39
  • 2
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Cryptography Stack Exchange](http://crypto.stackexchange.com/) or [Information Security Stack Exchange](http://security.stackexchange.com/) would be a better place to ask. – jww Jul 10 '17 at 09:08
  • 2
    Also see [To Hash or Not to Hash Again? (In)Differentiability Results for H^2 and HMAC](https://www.cs.ucsb.edu/~tessaro/papers/h2fullprelim.pdf) – jww Jul 10 '17 at 09:10

1 Answers1

2

"A common rationale for hashing twice is to guard against the length-extension property of the hash"

Full answer here https://crypto.stackexchange.com/questions/50017/why-hashing-twice

Timur Lemeshko
  • 2,747
  • 5
  • 27
  • 39