feat: initial implementation of XMSS hash-sig in pure zig#1
Merged
ch4r10t33r merged 5 commits intomasterfrom Sep 30, 2025
Merged
feat: initial implementation of XMSS hash-sig in pure zig#1ch4r10t33r merged 5 commits intomasterfrom
ch4r10t33r merged 5 commits intomasterfrom
Conversation
ch4r10t33r
added a commit
that referenced
this pull request
Oct 11, 2025
CRITICAL BUG FIX: SIMD was using wrong chain length - Was: hardcoded chain_length = 256 (2^8) - Should be: 2^winternitz_w = 2^3 = 8 from parameters - This caused SIMD to do 32x more work per chain! Changes to simd_winternitz.zig: - Removed hardcoded chain_length constant - Pass signature_params to generatePublicKey(), sign(), verify() - Compute chain_len = 2^winternitz_w from parameters - Now matches standard implementation parameters Changes to simd_signature.zig: - Added parallel worker threads (copied from signature.zig) - Added arena allocators for workers (optimization #1) - Added adaptive threading thresholds - Now matches standard implementation architecture Performance Impact: Before fix: 83 seconds (10x SLOWER than standard!) After fix: 3.6 seconds (2.33x FASTER than standard!) Improvement: 23x faster SIMD performance Known Issue:⚠️ SIMD generates different public keys than standard⚠️ Signature verification fails (algorithmic difference)⚠️ SIMD and Standard are NOT compatible Root cause: SIMD hash implementation produces different outputs This needs investigation - may be intentional SIMD-specific algorithm Standard Implementation Status: ✅ Performance: 77 seconds (optimized with arena + batching) ✅ Signature verification: WORKING ✅ All tests pass ✅ Ready for production SIMD Implementation Status: ✅ Performance: 3.6 seconds (2.33x faster than standard!) ❌ Compatibility: NOT compatible with standard (different keys) ❌ Signature verification: Fails cross-implementation⚠️ Use only if SIMD-specific signatures are acceptable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an initial implementation of XMSS-like signature scheme (inspired from https://github.com/b-wagn/hash-sig) with the following components: