Tagged hashes
Terms used in this lesson
- BIP340
- The Bitcoin Improvement Proposal specifying Schnorr signatures for the secp256k1 curve.
- Preimage
- The original secret data whose hash equals a previously committed value.
- SHA-256
- A cryptographic hash function used throughout Bitcoin to produce fixed-size 256-bit digests.
- BIP0340 challenge tag
- The domain-separation label used by BIP340 when hashing the Schnorr signature challenge.
A tagged hash adds a purpose label before hashing. This stops the same bytes from being mistaken for a message used by a different protocol rule.
Loading lesson visuals...
Learn the idea
Domain separation makes the same bytes hash differently in different protocol contexts. BIP340 tagged hashing defines H_tag(m) as SHA-256(SHA-256(tag) || SHA-256(tag) || m). The repeated tag digest initializes SHA-256 with a context-specific prefix.
Name the protocol context
Choose a fixed tag such as BIP0340/challenge that describes one exact use. Tags are part of the specification, not user-selected labels.
Inspect every idea above to open it.
The context must be part of the bytes fed into the defined cryptographic construction. Documentation alone does not alter the digest.
The questions unlock after every required learning activity
Inspect every guided idea, open the worked example, rebuild its mechanism, and complete the deterministic lesson tool. Your progress is saved automatically.