Crate hbs_lms[−][src]
Expand description
This library implements the Leighton-Micali-Signature scheme https://datatracker.ietf.org/doc/html/rfc8554
Example
use hbs_lms::*;
let message: [u8; 7] = [42, 84, 34, 12, 64, 34, 32]; // Some message that needs to be signed
// Generate keys for a 2-level HSS system (first Level W8/H5, second level W4/H15) using the standard software hashing implementation
let key_pair = hbs_lms::keygen::<Sha256Hasher>(&[HssParameter::new(LmotsAlgorithm::LmotsW8, LmsAlgorithm::LmsH5), HssParameter::new(LmotsAlgorithm::LmotsW4, LmsAlgorithm::LmsH5)], None, None).unwrap();
let private_key = key_pair.get_private_key();
let public_key = key_pair.get_public_key();
let mut private_key_update_function = |new_private_key: &[u8]| {
// Update private key and save it to disk
true // Report successful result
};
let sig = hbs_lms::sign::<Sha256Hasher>(&message, private_key, &mut private_key_update_function, None).unwrap();
let sig_slice = sig.as_slice();
let verify_result = hbs_lms::verify::<Sha256Hasher>(&message, sig_slice, public_key);
assert!(verify_result == true);
Structs
Describes a public and private key.
Specify Winternitz parameter and Tree height for one HSS Level.
An array is passed to the keygen
function describing each HSS level respectively.
Standard software implementation for Sha256. Can be passed into the library, because it implements the Hasher
trait.
Enums
Specifies the used Winternitz parameter.
Specifies the used Tree height.
Traits
This trait is used inside the library to generate hashes. A standard software implementation exists as Sha256Hasher
.
It can be used to outsource calculations to hardware accelerators.