pub struct Pedersen<C: SonobeCurve, const H: bool> { /* private fields */ }Expand description
Pedersen defines the out-of-circuit Pedersen widget, where H controls
whether the scheme is hiding or not.
Trait Implementations§
Source§impl<C: SonobeCurve> CommitmentDef for Pedersen<C, false>
impl<C: SonobeCurve> CommitmentDef for Pedersen<C, false>
Source§const IS_HIDING: bool = false
const IS_HIDING: bool = false
CommitmentDef::IS_HIDING indicates whether the commitment scheme has
the hiding property.Source§type Key = PedersenKey<C, false>
type Key = PedersenKey<C, false>
CommitmentDef::Key is the type of the commitment key.Source§type Scalar = <C as PrimeGroup>::ScalarField
type Scalar = <C as PrimeGroup>::ScalarField
CommitmentDef::Scalar is the type of the scalars being committed to. Read moreSource§type Commitment = C
type Commitment = C
CommitmentDef::Commitment is the type of the commitment. Read moreSource§type Randomness = Null
type Randomness = Null
CommitmentDef::Randomness is the type of the randomness used in
the commitment. Read moreSource§impl<C: SonobeCurve> CommitmentDef for Pedersen<C, true>
impl<C: SonobeCurve> CommitmentDef for Pedersen<C, true>
Source§const IS_HIDING: bool = true
const IS_HIDING: bool = true
CommitmentDef::IS_HIDING indicates whether the commitment scheme has
the hiding property.Source§type Key = PedersenKey<C, true>
type Key = PedersenKey<C, true>
CommitmentDef::Key is the type of the commitment key.Source§type Scalar = <C as PrimeGroup>::ScalarField
type Scalar = <C as PrimeGroup>::ScalarField
CommitmentDef::Scalar is the type of the scalars being committed to. Read moreSource§type Commitment = C
type Commitment = C
CommitmentDef::Commitment is the type of the commitment. Read moreSource§type Randomness = <C as PrimeGroup>::ScalarField
type Randomness = <C as PrimeGroup>::ScalarField
CommitmentDef::Randomness is the type of the randomness used in
the commitment. Read moreSource§impl<C: SonobeCurve> CommitmentOps for Pedersen<C, false>
impl<C: SonobeCurve> CommitmentOps for Pedersen<C, false>
Source§fn generate_key(
len: usize,
rng: impl RngCore,
) -> Result<PedersenKey<C, false>, Error>
fn generate_key( len: usize, rng: impl RngCore, ) -> Result<PedersenKey<C, false>, Error>
CommitmentOps::generate_key defines the key generation algorithm,
which is a randomized algorithm that takes as input the maximum length
len of supported messages, and a randomness source rng, and outputs
the commitment key.Source§fn commit(
ck: &PedersenKey<C, false>,
v: &[CF1<C>],
_rng: impl RngCore,
) -> Result<(C, Null), Error>
fn commit( ck: &PedersenKey<C, false>, v: &[CF1<C>], _rng: impl RngCore, ) -> Result<(C, Null), Error>
CommitmentOps::commit defines the commitment generation algorithm,
which is a (probably) randomized algorithm that takes as input
commitment key ck, a vector of scalars v to be committed to, and a
randomness source rng, and outputs the commitment and the randomness.Source§fn open(
ck: &PedersenKey<C, false>,
v: &[CF1<C>],
_r: &Null,
cm: &C,
) -> Result<(), Error>
fn open( ck: &PedersenKey<C, false>, v: &[CF1<C>], _r: &Null, cm: &C, ) -> Result<(), Error>
CommitmentOps::open defines the commitment opening algorithm, which
is a deterministic algorithm that takes as input commitment key ck,
a vector of scalars v, the randomness r, and a commitment cm, and
outputs Ok(()) if the opening verifies, or an error otherwise.Source§impl<C: SonobeCurve> CommitmentOps for Pedersen<C, true>
impl<C: SonobeCurve> CommitmentOps for Pedersen<C, true>
Source§fn generate_key(
len: usize,
rng: impl RngCore,
) -> Result<PedersenKey<C, true>, Error>
fn generate_key( len: usize, rng: impl RngCore, ) -> Result<PedersenKey<C, true>, Error>
CommitmentOps::generate_key defines the key generation algorithm,
which is a randomized algorithm that takes as input the maximum length
len of supported messages, and a randomness source rng, and outputs
the commitment key.Source§fn commit(
ck: &PedersenKey<C, true>,
v: &[CF1<C>],
rng: impl RngCore,
) -> Result<(C, CF1<C>), Error>
fn commit( ck: &PedersenKey<C, true>, v: &[CF1<C>], rng: impl RngCore, ) -> Result<(C, CF1<C>), Error>
CommitmentOps::commit defines the commitment generation algorithm,
which is a (probably) randomized algorithm that takes as input
commitment key ck, a vector of scalars v to be committed to, and a
randomness source rng, and outputs the commitment and the randomness.Source§fn open(
ck: &PedersenKey<C, true>,
v: &[CF1<C>],
r: &CF1<C>,
cm: &C,
) -> Result<(), Error>
fn open( ck: &PedersenKey<C, true>, v: &[CF1<C>], r: &CF1<C>, cm: &C, ) -> Result<(), Error>
CommitmentOps::open defines the commitment opening algorithm, which
is a deterministic algorithm that takes as input commitment key ck,
a vector of scalars v, the randomness r, and a commitment cm, and
outputs Ok(()) if the opening verifies, or an error otherwise.impl<C: Eq + SonobeCurve, const H: bool> Eq for Pedersen<C, H>
Source§impl<C: SonobeCurve> GroupBasedCommitment for Pedersen<C, false>
impl<C: SonobeCurve> GroupBasedCommitment for Pedersen<C, false>
Source§type Gadget1 = PedersenGadget<C, false>
type Gadget1 = PedersenGadget<C, false>
GroupBasedCommitment::Gadget1 points to the in-circuit gadget for
the group-based commitment scheme over the curve’s base field.Source§type Gadget2 = PedersenEmulatedGadget<C, false>
type Gadget2 = PedersenEmulatedGadget<C, false>
GroupBasedCommitment::Gadget2 points to the in-circuit gadget for
the group-based commitment scheme over the curve’s scalar field.Source§impl<C: SonobeCurve> GroupBasedCommitment for Pedersen<C, true>
impl<C: SonobeCurve> GroupBasedCommitment for Pedersen<C, true>
Source§type Gadget1 = PedersenGadget<C, true>
type Gadget1 = PedersenGadget<C, true>
GroupBasedCommitment::Gadget1 points to the in-circuit gadget for
the group-based commitment scheme over the curve’s base field.Source§type Gadget2 = PedersenEmulatedGadget<C, true>
type Gadget2 = PedersenEmulatedGadget<C, true>
GroupBasedCommitment::Gadget2 points to the in-circuit gadget for
the group-based commitment scheme over the curve’s scalar field.impl<C: PartialEq + SonobeCurve, const H: bool> StructuralPartialEq for Pedersen<C, H>
Auto Trait Implementations§
impl<C, const H: bool> Freeze for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
impl<C, const H: bool> RefUnwindSafe for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
C: RefUnwindSafe,
impl<C, const H: bool> Send for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
impl<C, const H: bool> Sync for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
impl<C, const H: bool> Unpin for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
C: Unpin,
impl<C, const H: bool> UnsafeUnpin for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
impl<C, const H: bool> UnwindSafe for Pedersen<C, H>where
<C as Val>::Var: Sized,
<C as CurveGroup>::Config: Sized,
<<C as CurveGroup>::BaseField as Val>::Var: for<'a> Sized,
<C as CurveGroup>::BaseField: Sized,
<<C as PrimeGroup>::ScalarField as Val>::Var: for<'a> Sized,
<C as PrimeGroup>::ScalarField: Sized,
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more