Expand description
SLH-DSA-SHA2-128s.
SLH-DSA-SHA2-128s is a post-quantum signature scheme. Its has a security reduction to the underlying hash function (SHA-256), giving an extremely high level of cryptoanalytic security. However, it has very large signatures (7856 bytes) and signing is very slow (only a few operations per core second on high-powered cores). A given private key may only be used to sign 264 different messages.
use bssl_crypto::slhdsa;
// Generate a key pair.
let (public_key, private_key) = slhdsa::PrivateKey::generate();
// Sign a message.
let message = b"test message";
let signature = private_key.sign(message);
// Verify the signature.
assert!(public_key.verify(message, &signature).is_ok());
// Signing with a context value.
let context = b"context";
let signature2 = private_key.sign_with_context(message, context)
.expect("signing will always work if the context is less than 256 bytes");
// The signature isn't value without a matching context.
assert!(public_key.verify(message, &signature2).is_err());
// ... but works with the correct context.
assert!(public_key.verify_with_context(message, &signature2, context).is_ok());Structs§
- Private
Key - An SLH-DSA-SHA2-128s private key.
- Public
Key - An SLH-DSA-SHA2-128s public key.
Constants§
- PRIVATE_
KEY_ BYTES - The number of bytes in an SLH-DSA-SHA2-128s private key.
- PUBLIC_
KEY_ BYTES - The number of bytes in an SLH-DSA-SHA2-128s public key.
- SIGNATURE_
BYTES - The number of bytes in an SLH-DSA-SHA2-128s signature.