feat(ciphers): add Merkle signature scheme - #7629
Merged
alxkm merged 1 commit intoOct 4, 2026
Merged
Conversation
dilaraacetin
requested review from
DenizAltunkapan,
alxkm and
yanglbme
as code owners
October 4, 2026 12:08
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7629 +/- ##
============================================
+ Coverage 81.64% 81.69% +0.04%
- Complexity 8167 8194 +27
============================================
Files 837 838 +1
Lines 25655 25734 +79
Branches 5009 5027 +18
============================================
+ Hits 20947 21024 +77
- Misses 3922 3923 +1
- Partials 786 787 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alxkm
approved these changes
Oct 4, 2026
alxkm
left a comment
Member
There was a problem hiding this comment.
Looks good. Thank you for the contribution.
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.
Fixes #7628
Description
Adds an educational implementation of the Merkle Signature Scheme (MSS) to the
cipherspackage. MSS turns a one-time signature scheme into a many-time scheme. It authenticates 2^h Winternitz one-time key pairs under a single public key, which is the root of a binary hash tree.This builds directly on the recently merged
WinternitzSignature(#) and continues the hash-based signature series: Lamport → WOTS → MSS. The same construction forms the core of XMSS (RFC 8391).How it works
WinternitzSignatureinstances are created. Each leaf isSHA-256of the concatenated WOTS public key, each parent isSHA-256(left || right), and the root is the MSS public key.IllegalStateExceptionis thrown once all 2^h keys are used.MessageDigest.isEqual.Changes
src/main/java/com/thealgorithms/ciphers/MerkleSignatureScheme.java: implementation with a nested immutableMerkleSignatureclasssrc/test/java/com/thealgorithms/ciphers/MerkleSignatureSchemeTest.java: JUnit 5 testsNo other files are modified.
Design notes
WinternitzSignatureclass, so no hashing or chain logic is duplicated.Tests
IllegalStateException, andremainingSignatures()decreases correctly.mvn clean verifypasses locally, and all files are formatted withclang-format -i --style=file.References
Checklist
clang-format -i --style=file path/to/your/file.java