A WebAssembly-accelerated implementation of a hybrid signature scheme that combines classical ECDSA with post-quantum CRYSTALS-Dilithium.
This project implements a hybrid signature scheme that satisfies three key properties from academic literature:
- Proof Composability - Signatures can be verified independently
- Strong Non-Separability - Signatures are linked through a shared challenge
- Simultaneous Verification - Signature can be verified in a single operation
The implementation uses WebAssembly for performance optimization through the dilithium-crystals library.
- Hybrid key generation combining ECDSA (secp256k1) and CRYSTALS-Dilithium
- Standard signature approach (separate signatures concatenated)
- True hybrid FS-FS approach (Fiat-Shamir with shared challenge)
- Constant-time challenge verification for security
- WebAssembly acceleration for Dilithium operations
- Performance benchmarking between approaches
npm installconst hybridSignature = require('./lib/hybrid-signature-wasm-final');
async function example() {
// Generate a key pair
const keyPair = await hybridSignature.generateKeyPair();
// Create a message
const message = Buffer.from('This is a secure message');
// Sign the message
const signature = await hybridSignature.signHybrid(message, keyPair.privateKey);
// Verify the signature
const isValid = await hybridSignature.verifyHybrid(message, signature, keyPair.publicKey);
console.log('Signature is', isValid ? 'valid' : 'invalid');
}
example();Generates a hybrid key pair containing both ECDSA and Dilithium keys.
Signs a message using the standard approach (separate signatures).
Verifies a message signed with the standard approach.
Signs a message using the true hybrid FS-FS approach with shared challenge.
Verifies a message signed with the true hybrid approach.
# Run the final implementation test
npm run test-hybrid-final
# Run a simple demo
npm run demo-hybrid-wasmThis implementation is provided for research and educational purposes. Before using in a production environment:
- Conduct a thorough security audit
- Implement proper key management practices
- Consider the tradeoffs of increased signature size and computational overhead
MIT