Crate lamport_signature_plus

Source
Expand description

Implementation of Lamport’s one-time signature scheme.

§Usage

use lamport_signature_plus::{VerifyingKey, SigningKey, LamportFixedDigest};
use sha2::Sha256;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;

let mut rng = ChaChaRng::from_entropy();
let mut signing_key = SigningKey::<LamportFixedDigest<Sha256>>::random(rng);
let verifying_key = VerifyingKey::from(&signing_key);
let signature = signing_key.sign(b"Hello, World!").expect("signing failed");
assert!(verifying_key.verify(&signature, b"Hello, World!").is_ok());

§Digest Algorithm

SigningKey and VerifyingKey can use any digest algorithm types that provided by RustCrypto/hashes as a type argument to construct. Algorithms can be either fixed output size or extendable output size. Extendable Output Size algorithms default to 32 byte lengths.

§Example of Extendable Output Size

use lamport_signature_plus::{VerifyingKey, SigningKey, LamportExtendableDigest};
use sha3::Shake128;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;

let mut rng = ChaChaRng::from_entropy();
let mut signing = SigningKey::<LamportExtendableDigest<Shake128>>::random(rng);
let verifying = VerifyingKey::from(&signing);
let signature = signing.sign(b"Hello, World!").expect("signing failed");
assert!(verifying.verify(&signature, b"Hello, World!").is_ok());

§RNG Algorithm

SigningKey takes the cryptographically secure RNG implemented in rust-lang-nursery/rand as an argument to construct, i.e. RNG must implement the RngCore and CryptoRng traits.

§Note

SigningKey can only be used once to securely sign a message. If an attempt is made to sign a message with a used key, an error returns.

Structs§

LamportExtendableDigest
Lamport signature scheme than uses extendable output functions.
LamportFixedDigest
Lamport signature scheme than uses fixed output functions.
MultiVec
A multi-dimensional vector. This is faster and simpler than using Vec<Vec<…>>
Signature
A signature data generated by [SigningKey].
SignatureShare
A signature share generated by [SigningKeyShare].
SigningKey
A one-time signing private key.
SigningKeyShare
A key share that must be combined with other secret key shares to produce the signing key, or used for creating partial signatures.
VerifyingKey
A one-time signing public key.

Enums§

LamportError
Errors in lamport signing scheme.

Traits§

LamportDigest
A trait for providing Lamport supported digest functions.

Functions§

generate_keys
Generate a new pair of keys.

Type Aliases§

LamportResult
Result type for Lamport errors.