Skip to contents

The textbook hash-based signature (Lamport 1979): 256 secret pairs of 32 random bytes; the public key is their SHA-256 images. Security reduces entirely to SHA-256 preimage resistance — a post-quantum assumption — but each keypair signs EXACTLY ONE message. Signing twice with the same key leaks enough secrets to forge; morie_crypto_lamport_sign therefore refuses a key it has already used in this session. For many-time hash-based signatures use morie_crypto_slhdsa_keygen (SLH-DSA).

Usage

morie_crypto_lamport_keygen()

Value

An object of class morie_lamport_keypair: list with pk (2 x 256 matrix of hex strings) and sk (2 x 256 list matrix of raw secrets).

References

Lamport, L. (1979). Constructing digital signatures from a one-way function. SRI CSL-98.

Examples

kp <- morie_crypto_lamport_keygen()
sig <- morie_crypto_lamport_sign(kp, "hello")
morie_crypto_lamport_verify(kp$pk, "hello", sig)
#> [1] TRUE