package slhdsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=20087fca24222c6de0db3a2d2b05f9c1
sha512=69bdfe62d0a93ff4dbe85280b7fd3db9970adbc36f52891f63e727a4eb32a19bfccf727a62d3740d4771522489cdcbb4feaa3537cdd9b183962252065674ed32
doc/slhdsa/Slhdsa/Sha2_128s/index.html
Module Slhdsa.Sha2_128sSource
SLH-DSA-SHA2-128s, as standardized by FIPS 205.
The SHA2 hash family at security level 128, so the security parameter n is 16 bytes. This is the small-signature (s) variant: smaller signatures and slower signing than SLH-DSA-SHA2-128f.
Operations, randomness contract, and encodings are documented in the shared signature below.
pp_error formats an error for humans.
The size of a key-generation seed: 3 * n bytes.
The size of an encoded signing key: 4 * n bytes.
The size of an encoded verification key: 2 * n bytes.
The size of an encoded signature, in bytes.
generate ~random () creates a key pair from seed_size bytes obtained from random. It builds the top-level Merkle tree, which is markedly slower for the s parameter sets because their trees are taller.
signing_key_of_seed seed expands a seed_size-byte key-generation seed.
signing_key_to_seed key returns the seed_size-byte seed key was generated from, or None when key was imported with signing_key_of_octets and no seed is recoverable. The result is secret key material.
signing_key_of_octets octets parses the signing_key_size-byte encoding. It recomputes the top-level Merkle root and returns Invalid_encoding when the embedded root disagrees, so importing a key costs about as much as generating one.
signing_key_to_octets key returns the encoded key. The result is secret key material.
verification_key_of_signing_key key extracts the public half of a key pair.
verification_key_of_octets octets checks the length only; a verification key carries nothing that can be validated on its own.
val sign :
?context:string ->
random:(int -> string) ->
signing_key ->
message:string ->
(signature, error) resultsign ?context ~random key ~message produces a hedged PureSLH-DSA signature, drawing n fresh bytes from random as the randomizer for this signature. Prefer it over sign_deterministic.
context defaults to "" and identifies the application's use of the signature. It is limited to 255 bytes by FIPS 205, and verification must supply the same value. A longer context returns Context_too_long.
val sign_deterministic :
?context:string ->
signing_key ->
message:string ->
(signature, error) resultsign_deterministic ?context key ~message signs with the FIPS 205 deterministic variant, using the public key seed as the randomizer instead of fresh entropy. The same key, message, and context always yield the same signature. Key generation still requires secure randomness.
verify ?context key ~message signature returns true only when signature is valid for message under key and the same context used when signing.