Skip to content

[FEATURE REQUEST] Add HORS (Hash to Obtain Random Subset) few-time signature scheme #7634

Closed

Description

@dilaraacetin

What would you like to Propose?

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)
  • byte[][] getPublicKey()
  • byte[][] sign(byte[] message)
  • static boolean verify(byte[] message, byte[][] signature, byte[][] publicKey)

Scope:

  • 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions