hashsigs-solidity
Summary
Expandhashsigs-solidity is a small library, written in Solidity and released by quip.network, for checking one-time digital signatures on a blockchain. It implements a scheme called WOTS+, in which each key is meant to sign a single message and no more. Other smart contracts call it to confirm that a signature matches a given public key and message. The library itself stores nothing: it holds no funds, keeps no secrets, and remembers nothing from one call to the next. Everything it works with arrives as input, namely the public key, a fingerprint of the message, and the signature to be checked.
Nothing in the library can be administered: it has no owner, and every routine is a plain calculation that changes nothing. Each input has a fixed size that the language enforces, so a signature with a missing or extra part cannot fit the call. The message fingerprint is split into small digits, each capped to the scheme's range before it is used. That cap is what keeps every step of the check within the bounds the scheme allows. In the main form of the check, the values mixed into each step are rebuilt from the public key itself.
This review found no vulnerabilities in hashsigs-solidity at commit `e542347`. The result follows from how little the code exposes: it keeps nothing between calls, so there is nothing stored for an input to corrupt. It has no owner and no privileged operations, so there is no administrative access to take over. Because every size and bound is written into the code, no caller gets to decide how far a calculation runs. The routines that create keys and sign messages take secrets as plain inputs, and the code marks them as reference material for a TypeScript port, not for use.
Findings
No issues identified
Technical detail
The controls above, with the code they were observed in
Layout. contracts/WOTSPlus.sol is a single library WOTSPlus implementing WOTS+ with keccak256 as its only hash primitive. It declares no storage, constructor, events, errors, or modifiers, and every function is pure, so the library has no owner, no privileged entry points, and no caller authentication of its own. The verification entry points are verify and verifyWithRandomizationElements. The chain walk, the element derivation, and the reference routines for key generation and signing are also public, and every other helper is internal. Scheme parameters are compile-time public constants such as HashLen, ChainLen, and NumSignatureChunks, never call arguments, and the comments map each onto the parameters of the WOTS+ paper and RFC 8391. The build is Hardhat with the viem toolbox: hardhat.config.ts loads @nomicfoundation/hardhat-toolbox-viem, pins a compiler version that satisfies the library’s pragma, and declares no optimizer, network, or verification settings. ignition/modules/Lock.ts is the Hardhat starter template’s sample module and does not reference WOTSPlus.
Verification. verify takes the public key, the message, and the signature as calldata arguments of fixed size. The key is a WinternitzAddress carrying a publicSeed and a publicKeyHash. The signature is a WinternitzElements wrapping a bytes32[NumSignatureChunks] array, and the message is a WinternitzMessage holding a single hash that the library never hashes again. The fixed-size types replace the length checks that survive only as DEBUG comments, leaving the sole live require in sign. verify regenerates the randomization elements from publicSeed through generateRandomizationElements rather than accepting the elements from the caller. It derives the chain indices with ComputeMessageHashChainIndexes and walks each signature element forward through chain from its index to the end of the chain. The recovered segments are packed into a buffer whose Hash is compared with publicKeyHash, and a mismatch yields false rather than a revert. verifyWithRandomizationElements repeats the same loop with elements supplied as a memory argument and does not read publicSeed.
Chain bounds. ComputeMessageHashChainIndexes is the only place a message becomes chain indices, and every signing and verifying routine calls it. It fills the message digits by running toBaseW over the packed messageHash, then appends the checksum digits from checksum. toBaseW consumes its input high nibble first and masks each value with ChainLen - 1, so every digit lies below ChainLen. That mask, rather than any range check, is what keeps each later chain walk inside the chain. checksum sums the complement of each message digit into a uint16, serializes the total big-endian as its comment notes RFC 8391 does, and converts it to digits at offset NumMessageChunks. chain carries no range check of its own, and each of its in-library callers passes an index and step count summing to at most ChainLen - 1. All counters and offsets in these functions are uint8 or uint16.
Primitives. setSlice32 is the file’s only inline assembly, a single mstore of a word at the given offset past the length slot of a bytes memory buffer, and it has no bounds check of its own. Its callers are verify, verifyWithRandomizationElements, and generateKeyPair. Each allocates new bytes(SignatureSize) and advances the offset by HashLen per segment up to NumSignatureChunks, so the final write ends on the buffer’s last byte. xor combines its bytes32 operands through uint256 casts and the native exclusive-or. Hash wraps keccak256 for chain steps, secret segment derivation, and the public key hash. The file contains no unchecked blocks, so all of its arithmetic keeps the compiler’s default overflow checks.
Key derivation. prf is the single derivation primitive: keccak256 over a fixed domain-prefix byte, the seed, and a uint16 index. generateRandomizationElements fills every element with prf of publicSeed and the element’s index, so the elements are a deterministic function of the seed carried in the public key. generateKeyPair derives the private key from privateSeed through prf, then the public seed from the private key the same way. Each secret segment is the Hash of functionKey concatenated with a per-segment prf output, walked the full chain and packed into the buffer whose hash becomes the public key hash. functionKey is the first randomization element, an entry that chain never reads, and a TODO beside it asks that its handling be compared against XMSS. sign rebuilds the same seed, elements, and secret segments from the private key and walks each segment only as many steps as its chain index. Both sign and generateKeyPair take secret material as plain arguments and carry a comment reading “Do not use this”, describing them as references for a TypeScript port.
Conclusion
ExpandThe review examined the routine that checks a signature against a public key, together with the variant that accepts the mixing values from the caller. It examined how a message fingerprint is turned into the digits that drive the check, including the short check value appended to them. It examined the derivation of keys and of the values mixed into every step, the one place where the code writes directly into memory, and the arithmetic throughout. It also went through the build configuration and the sample deployment script shipped alongside the library.
For the signers whose keys and signatures this code checks, the examination found no way for a submitted input to alter what the library holds, because it holds nothing. It found no way for an administrator’s access to be taken over, because no such access exists. It found no way for a signature or message of the wrong shape to reach the calculation. Nor did it find a way for a well-formed one to carry the calculation past the limits written into the code. This review found no vulnerabilities in hashsigs-solidity at commit e542347.
Legal Disclaimer: This report covers the code submitted for analysis. It does not account for infrastructure, deployment configuration, third-party dependencies, or changes made after the audit date. Automated analysis may produce false positives or miss context-dependent vulnerabilities. audited.xyz provides this report “as is” without warranty of any kind.