Struct 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 duplicate 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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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>

Source§

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

The witness for the relation.
Source§

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

The elements of the statement the prover is proving.
Source§

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.
Source§

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.
Source§

type ChallengeLength = <A as Sigma>::ChallengeLength

The length as a typenum
Source§

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

§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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§

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

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.