Crate lamport_signature [] [src]

A Rust implementation of the Lamport one-time signature scheme.

Notice

This crate can build only on the nightly channel.

Usage

extern crate lamport_signature;
extern crate sha2;
extern crate rand;

use lamport_signature::{PublicKey, PrivateKey, generate_keys};
use sha2::Sha256;
use rand::thread_rng;

let mut rng = thread_rng();
let (mut private_key, public_key) = generate_keys::<Sha256, _>(&mut rng);

let signature = private_key.sign(b"Hello, World!").expect("signing failed");
assert!(public_key.verify(&signature, b"Hello, World!"));

Digest Algorithm

PrivateKey and PublicKey should take the fixed output size digest algorithm types that provided by RustCrypto/hashes as a type argument to construct.

RNG Algorithm

PrivateKey and PublicKey also should take the specified RNG implemented in rust-lang-nursery/rand as an argument to construct.

Structs

PrivateKey

A one-time signing private key.

PublicKey

A one-time signing public key.

Signature

A signature data generated by PrivateKey.

Enums

Error

Errors in sign-verify scheme.

Functions

generate_keys

Generates a PrivateKey and PublicKey at once.