You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE REQUEST] Add HORS (Hash to Obtain Random Subset) few-time signature scheme #7634
I would like to add an educational implementation of HORS (Hash to Obtain Random Subset), a hash-based few-time signature scheme (Reyzin & Reyzin, 2002), to the ciphers package.
HORS is the predecessor of FORS, the few-time signature used inside SLH-DSA/SPHINCS+ (FIPS 205). Together with the existing Lamport, Winternitz (WOTS) and Merkle Signature Scheme implementations, it would cover all the core building blocks of SPHINCS+.
Issue details
Algorithm: HORS (Reyzin & Reyzin, "Better than BiBa", ACISP 2002)
Problem statement: One-time signatures such as Lamport and WOTS become insecure after a single use. HORS is a few-time signature: one key pair can sign a small number of messages, with security decreasing gradually as more secret values are revealed. Signing and verification only require k hash evaluations.
How it works:
Key generation: generate t = 2^τ random secret values; the public key is their hashes, pk[i] = H(sk[i]).
Signing: hash the message and split the digest into k chunks of τ bits. Each chunk is interpreted as an index, and the signature consists of the secret values at those k indices.
Verification: derive the same indices from the message and check that the hash of each revealed value matches the public key at that index.
Proposed API (com.thealgorithms.ciphers.HorsSignature):
HorsSignature() with t = 1024, k = 16 (parameters suggested in the paper) / HorsSignature(int t, int k)
SHA-256 via java.security.MessageDigest; no external dependencies
JUnit 5 tests: valid signatures, signing multiple messages with one key, deterministic signing, tampered message/signature, wrong public key, known-vector tests for index derivation, parameterized (t, k), input validation and immutability
Only two new files (implementation + test)
Additional Information
This is a follow-up to the existing hash-based signatures in the repository (Lamport, Winternitz OTS and the Merkle Signature Scheme) and is intended for educational purposes only. The Javadoc will explain the few-time security degradation and how FORS in SLH-DSA improves on HORS.
References:
Reyzin & Reyzin, "Better than BiBa: Short One-time Signatures with Fast Signing and Verifying": https://eprint.iacr.org/2002/014
Activity