Struct lamport_signature::PrivateKey
[−]
[src]
pub struct PrivateKey<T> { /* fields omitted */ }
A one-time signing private key.
Methods
impl<T> PrivateKey<T>
[src]
pub fn used(&self) -> bool
[src]
Whether or not the PrivateKey was used.
impl<T> PrivateKey<T> where
T: Digest,
[src]
T: Digest,
pub fn new<R>(rng: &mut R) -> PrivateKey<T> where
R: RngCore,
[src]
R: RngCore,
Constructs a PrivateKey with Digest algorithm type and the specified RNG.
pub fn public_key(&self) -> PublicKey<T>
[src]
Generates a PublicKey from the PrivateKey.
pub fn sign(&mut self, data: &[u8]) -> Result<Signature, Error>
[src]
Signs the data.
Example
extern crate sha2; extern crate rand; extern crate lamport_signature; use sha2::Sha256; use rand::{XorShiftRng, SeedableRng}; use lamport_signature::PrivateKey; const SEED: [u8; 16] = [0; 16]; let mut rng = XorShiftRng::from_seed(SEED); let mut private_key = PrivateKey::<Sha256>::new(&mut rng); const MESSAGE: &[u8] = b"hello, world!"; assert!(private_key.sign(MESSAGE).is_ok());
Trait Implementations
impl<T: Debug> Debug for PrivateKey<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Clone> Clone for PrivateKey<T>
[src]
fn clone(&self) -> PrivateKey<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> Drop for PrivateKey<T>
[src]
impl<T> PartialEq for PrivateKey<T>
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T> Eq for PrivateKey<T>
[src]
impl<T> PartialOrd for PrivateKey<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> Ord for PrivateKey<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<T> Hash for PrivateKey<T>
[src]
Auto Trait Implementations
impl<T> Send for PrivateKey<T> where
T: Send,
T: Send,
impl<T> Sync for PrivateKey<T> where
T: Sync,
T: Sync,