[][src]Struct leslie_lamport::LamportSignature

pub struct LamportSignature {
    pub hash: Algorithms,
    pub pk: Vec<String>,
    pub input: String,
    pub signature: Vec<String>,
}

Lamport Signature

After Signing with the LamportKeyPair struct, you can keep the LamportSignature struct Public. Your LamportKeyPair will now be useless for signing as it's a One-Time Signature.

This Struct Contains:

  • The Hashing Algorithm as Enum Algorithms
  • The Public Key as a Vector<Strings>
  • The Input String as a String
  • The Signature as a Vector<Strings>

Example Usage

Its Only Function is for Verification Purposes

use leslie_lamport::{LamportKeyPair,Algorithms,LamportSignature};
 
// Generate Keypair
let keypair = LamportKeyPair::generate(Algorithms::OS_SHA256);
 
// Generates a "LamportSignature" Struct for a One-Time Signature For a 512-bit Hexadecimal String
let signature = keypair.sign("A55FE31CB83313443F38356A065F9E6386BE591C30490ECC6994B0C152D46D80ABC010DF01257FFEC437402967995D5C34EAD950E0C62C3BCAFF34BCEFB3BDF7");
 
// Verify Signature
let is_verified: bool = signature.verify();
 

Fields

hash: Algorithmspk: Vec<String>input: Stringsignature: Vec<String>

Implementations

impl LamportSignature[src]

pub fn verify(&self) -> bool[src]

The Verify Function that returns a boolean value when verifying whether the signature matches the public key and input

It must:

  • The Number of Public Keys must be divisible by 8 and then 2 to retrieve n
  • THe Number of Signatures must be at most half of the Public Keys
  • The Input Must Be At Most The Size Of n in Bytes And Be In Hexadecimal (which is converted to binary)

Trait Implementations

impl Clone for LamportSignature[src]

impl Debug for LamportSignature[src]

impl<'de> Deserialize<'de> for LamportSignature[src]

impl Hash for LamportSignature[src]

impl PartialEq<LamportSignature> for LamportSignature[src]

impl PartialOrd<LamportSignature> for LamportSignature[src]

impl Serialize for LamportSignature[src]

impl StructuralPartialEq for LamportSignature[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.