This repo contains hash-based signatures that can protect Bitcoin against quantum computers
⚠️ This project is a work in progress and is provided as-is for research, learning, and experimentation. It is not production-ready and has not undergone a formal security audit, code review, or verification process. This library may be incorrect, incomplete, or insecure.
We use #include and #define directives, so you may need to install mcpp:
brew install mcppImportant
Currently, this project requires the bundled ./simfony binary due to upstream incompatibilities in simfony-cli. This will be updated once the upstream issues are resolved.
| Signature Scheme | File Path | Description |
|---|---|---|
| Lamport | lamport.simf |
Lamport one-time signature implementation. |
| WOTS | wots.simf |
Winternitz One-Time Signature implementation. |
| SHRINCS | shrincs/shrincs.simf |
SHRINCS implementation. C++. 📖 Read docs |
Note: Each signature contains method
X_verify(whereXis the scheme name) that verifies the validity of the signature for the corresponding message hash and public key
-
make test- runs all tests -
make lamport_example- runs Lamport verification example -
make shrincs_example MODE={stateful|stateless}- runs SHRINCS verification example- Use
MODE=statefulfor XMSS-based stateful trees orMODE=statelessfor SPHINCS-like stateless verification.
- Use
To execute this code, import the required signature file using #include directive and then run:
mkdir -p target
mcpp -P -I . your-file.simf -o target/your-file.simfTo run the preprocessed file, run:
./simfony run --witness your-witness.wit target/your-file.simf#include "./shrincs/shrincs.simf"
fn main() {
let message: u256 = ...;
let pk: (u128, u128) = ...;
let signature: Either<UXMSSSignature, SPHINCSSignature> = ...;
let known_pk_part: u128 = ...;
shrincs_verify((message, pk, signature, known_pk_part));
}🧩 Type Definitions: Wondering how
UXMSSSignatureorSPHINCSSignatureare structured under the hood? Check out the full type definitions intypes.simf.
📂 More Examples: For complete, runnable code including witness data setup, explore the
examples/directory.