Verifier

Struct Verifier 

Source
pub struct Verifier<C: Ciphersuite> { /* private fields */ }
Expand description

A batch verification context.

Implementations§

Source§

impl<C> Verifier<C>
where C: Ciphersuite,

Source

pub fn new() -> Verifier<C>

Constructs a new batch verifier.

Source

pub fn queue<I: Into<Item<C>>>(&mut self, item: I)

Queues an Item for verification.

Source

pub fn verify<R: RngCore + CryptoRng>(self, rng: R) -> Result<(), Error<C>>

Performs batch verification, returning Ok(()) if all signatures were valid and Err otherwise, or if the batch is empty.

The batch verification equation is:

h_G * -[sum(z_i * s_i)]P_G + sum([z_i]R_i + [z_i * c_i]VK_i) = 0_G

which we split out into:

h_G * -[sum(z_i * s_i)]P_G + sum([z_i]R_i) + sum([z_i * c_i]VK_i) = 0_G

so that we can use multiscalar multiplication speedups.

where for each signature i,

  • VK_i is the verification key;
  • R_i is the signature’s R value;
  • s_i is the signature’s s value;
  • c_i is the hash of the message and other data;
  • z_i is a random 128-bit Scalar;
  • h_G is the cofactor of the group;
  • P_G is the generator of the subgroup;

As follows elliptic curve scalar multiplication convention, scalar variables are lowercase and group point variables are uppercase. This does not exactly match the RedDSA notation in the protocol specification §B.1.

Trait Implementations§

Source§

impl<C> Default for Verifier<C>
where C: Ciphersuite,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Verifier<C>

§

impl<C> RefUnwindSafe for Verifier<C>

§

impl<C> Send for Verifier<C>
where <<C as Ciphersuite>::Group as Group>::Element: Send, <<<C as Ciphersuite>::Group as Group>::Field as Field>::Scalar: Send,

§

impl<C> Sync for Verifier<C>
where <<C as Ciphersuite>::Group as Group>::Element: Sync, <<<C as Ciphersuite>::Group as Group>::Field as Field>::Scalar: Sync,

§

impl<C> Unpin for Verifier<C>
where <<C as Ciphersuite>::Group as Group>::Element: Unpin, <<<C as Ciphersuite>::Group as Group>::Field as Field>::Scalar: Unpin,

§

impl<C> UnwindSafe for Verifier<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.