Struct sigma_fun::FiatShamir

source ·
pub struct FiatShamir<S, T> {
    pub transcript: T,
    pub sigma: S,
}
Expand description

Applies the Fiat-Shamir transform to a given Sigma protocol given a Transcript.

Fields§

§transcript: T

The transcript

§sigma: S

The sigma protocol

Implementations§

source§

impl<S: Sigma, T: Transcript<S>> FiatShamir<S, T>

source

pub fn new(sigma: S, transcript: T, override_name: Option<&str>) -> Self

Create a new non-interactive prover/verifier given a Sigma and a Transcript for that Sigma protocol.

source

pub fn prove<Rng: CryptoRng + RngCore>( &self, witness: &S::Witness, statement: &S::Statement, rng: Option<&mut Rng> ) -> CompactProof<S>
where T: ProverTranscript<S>,

Generates a proof given the witness, a statement and some optional additional randomness.

Optimistically, the proof should be secure without passing in rng but it is always recommended. to pass in secure system random number generator as rng.

source

pub fn verify(&self, statement: &S::Statement, proof: &CompactProof<S>) -> bool

Verifies the proof given the statement.

Trait Implementations§

source§

impl<S: Clone, T: Clone> Clone for FiatShamir<S, T>

source§

fn clone(&self) -> FiatShamir<S, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug, T: Debug> Debug for FiatShamir<S, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: Default + Sigma, T: Transcript<S> + Default> Default for FiatShamir<S, T>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<S, T> RefUnwindSafe for FiatShamir<S, T>

§

impl<S, T> Send for FiatShamir<S, T>
where S: Send, T: Send,

§

impl<S, T> Sync for FiatShamir<S, T>
where S: Sync, T: Sync,

§

impl<S, T> Unpin for FiatShamir<S, T>
where S: Unpin, T: Unpin,

§

impl<S, T> UnwindSafe for FiatShamir<S, T>
where S: UnwindSafe, T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.