Why is the previous block hash computed using a cryptographic hash function instead of a regular hash function in Bitcoin and other blockchains? What cryptographic hash properties (pre-image resistance, second pre-image resistance and collision resistance) are needed and why?


1 Answer 1


Collision resistance and pre-image resistance, both first and second, are important for Bitcoin. This answer may not apply to all blockchain instances.

Collision resistance is important for the property of distibuted consensus.

In bitcoin mining, the inputs for the function are all of the most recent, not-yet-confirmed transactions (along with some additional inputs relating to the timestamp and a reference to the previous block).

Think about what would happen if there were more than one input that could hash to the same value.

Preimage resistance is important to the mining process, and by extension to the strength of the consensus which is mined into the blockchain.

Each bitcoin block contains a nonce. The job of miners is to find a nonce value such that the resulting hash of the block contains a certain number of leading zeros. The number of zeroes corresponds to the difficulty of mining the blockchain. Without pre-image resistance, and depending upon the difficulty of finding a pre-image, it could be possible for miners to find a nonce value with less difficulty than by exhaustively enumerating the nonce field. If it were very easy to mine the blockchain, in particular if one group had a significant advantage in doing so, then they could launch an attack in which they control the majority of the hashing power of the bitcoin network. .

Finally, second pre-image resistance is necessary for the same reason as collision resistance. If a second input could be found which matched one of the block hash values then there would be uncertainty about the canonical state of the blockchain.

  • 1
    $\begingroup$ Mining heavily relies on preimage resistance. It essentially consists of finding an input of a certain form whose hash has a specific property. This could be sped up using a preimage attack on the hash function. $\endgroup$
    – yyyyyyy
    Jan 20, 2018 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.