Skip to content

Double SHA-256 (hash256)

Apply SHA-256 twice, as Bitcoin does for block headers and transaction ids — the construction that defeats length-extension.

Input

Double SHA-256

Enter something above to see the result.

Everything is processed locally in your browser. Your data never leaves this device.

Why Bitcoin hashes twice

SHA-256 is vulnerable to length extension: knowing SHA-256(secret ‖ m) lets an attacker compute the digest of a longer message without the secret. Hashing the digest again removes that property, because the second pass starts from a fixed initial state.

It is used for block headers, transaction ids and Base58Check checksums. The cost is one extra 32-byte compression, which is negligible.

Frequently asked questions

Is double SHA-256 twice as secure?

No. It closes the length-extension gap; collision resistance is unchanged at roughly 128 bits.

Is this the same as a Bitcoin txid?

The digest is the same computation, but a txid is conventionally displayed byte-reversed. Reverse the byte order if you are comparing with a block explorer.

Related tools