Struct sigma_fun::Or

source ·
pub struct Or<A, B> { /* private fields */ }
Expand description

Combinator for proving that A OR B is true.

Implementations§

source§

impl<A, B> Or<A, B>

source

pub fn new(lhs: A, rhs: B) -> Self

Create a Or<A,B> protocol from two other Sigma protocols

Trait Implementations§

source§

impl<A: Clone, B: Clone> Clone for Or<A, B>

source§

fn clone(&self) -> Or<A, B>

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<A: Debug, B: Debug> Debug for Or<A, B>

source§

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

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

impl<A: Default, B: Default> Default for Or<A, B>

source§

fn default() -> Or<A, B>

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

impl<A, B> Display for Or<A, B>
where Or<A, B>: Sigma,

source§

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

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

impl<A: PartialEq, B: PartialEq> PartialEq for Or<A, B>

source§

fn eq(&self, other: &Or<A, B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A: Sigma, B: Sigma<ChallengeLength = A::ChallengeLength>> Sigma for Or<A, B>

§

type Witness = Either<<A as Sigma>::Witness, <B as Sigma>::Witness>

The witness for the relation.
§

type Statement = (<A as Sigma>::Statement, <B as Sigma>::Statement)

The elements of the statement the prover is proving.
§

type Announcement = (<A as Sigma>::Announcement, <B as Sigma>::Announcement)

The type for the public announcement the prover sends in the first round of the protocol.
§

type AnnounceSecret = (Either<(<A as Sigma>::AnnounceSecret, <B as Sigma>::Response), (<A as Sigma>::Response, <B as Sigma>::AnnounceSecret)>, GenericArray<u8, <Or<A, B> as Sigma>::ChallengeLength>)

The type for the secret the prover creates when generating the proof.
§

type ChallengeLength = <A as Sigma>::ChallengeLength

The length as a typenum
§

type Response = ((<A as Sigma>::Response, GenericArray<u8, <Or<A, B> as Sigma>::ChallengeLength>), <B as Sigma>::Response)

The type for the response the prover sends in the last round of the protocol.
source§

fn respond( &self, witness: &Self::Witness, statement: &Self::Statement, announce_secret: Self::AnnounceSecret, announce: &Self::Announcement, challenge: &GenericArray<u8, Self::ChallengeLength> ) -> Self::Response

Generates the prover’s response for the verifier’s challenge.
source§

fn announce( &self, statement: &Self::Statement, announce_secret: &Self::AnnounceSecret ) -> Self::Announcement

Generates the prover’s announcement message.
source§

fn gen_announce_secret<Rng: CryptoRng + RngCore>( &self, witness: &Self::Witness, rng: &mut Rng ) -> Self::AnnounceSecret

Generates the secret data to create the announcement
source§

fn sample_response<Rng: CryptoRng + RngCore>( &self, rng: &mut Rng ) -> Self::Response

Uniformly samples a response from the response space of the Sigma protocol.
source§

fn implied_announcement( &self, statement: &Self::Statement, challenge: &GenericArray<u8, Self::ChallengeLength>, response: &Self::Response ) -> Option<Self::Announcement>

Computes what the announcement must be for the response to be valid.
source§

fn hash_statement<H: Update>(&self, hash: &mut H, statement: &Self::Statement)

Hashes the statement.
source§

fn hash_announcement<H: Update>( &self, hash: &mut H, announcement: &Self::Announcement )

Hashes the announcement.
source§

fn hash_witness<H: Update>(&self, hash: &mut H, witness: &Self::Witness)

Hashes the witness.
source§

impl<A: Writable, B: Writable> Writable for Or<A, B>

source§

fn write_to<W: Write>(&self, w: &mut W) -> Result

Asks the thing to write itself to W.
source§

impl<A, B> StructuralPartialEq for Or<A, B>

Auto Trait Implementations§

§

impl<A, B> RefUnwindSafe for Or<A, B>

§

impl<A, B> Send for Or<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Or<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Or<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for Or<A, B>
where A: UnwindSafe, B: 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.