Hash based signatures
The Winternitz scheme behind every HASHES vault, explained without the maths and then with it.
The idea in plain words
Picture a chain of padlocks where each one can only be opened by hashing the one before it. You start with a secret number and hash it over and over, 255 times. The very end of the chain is public. Anyone can see it. The start is your secret.
To sign something, you reveal a point somewhere along the chain. Where you stop depends on the message. Anyone can take what you revealed, keep hashing until they reach the public end, and check that it lines up. What they cannot do is go backwards, because undoing a hash is exactly the thing nobody can do, quantum computer or not.
A HASHES key is 34 of those chains side by side. Thirty two of them sign the message itself, one byte each. The last two sign a checksum, which we will come to, because it is the part that makes the whole thing safe.
The numbers
| Parameter | Value |
|---|---|
| Hash function | Keccak256, truncated to 28 bytes per chain step |
| Chains | 34 (32 for the message, 2 for the checksum) |
| Steps per chain | 255, one per possible byte value |
| Signature size | 952 bytes |
| Public key commitment | Keccak256 of all 34 chain ends, 32 bytes |
| Uses per key | One |
The message that gets signed is always the Keccak256 hash of exactly what the spend will do, such as the amount, the token and where it is going. Each of its 32 bytes picks how far along one chain the signature reveals.
Why the checksum matters
A plain Winternitz signature has a known weakness. Since anyone can hash forward, anyone who sees a signature can push some of its chains further along and produce a valid signature for a slightly different message. That is not a theoretical footnote. It would let an attacker change where your tokens go.
The checksum closes that door. We add up how far each message chain is from its end and sign that total on two extra chains. If someone pushes a message chain forward, the total goes down, and to make the checksum match they would need to move a checksum chain backwards. Going backwards needs the secret. So one revealed signature can never be bent into a signature over anything else.