pub struct PedersenGens<P: Compressable> {
    pub h_base: P,
    pub h_base_compressed: P::Compressed,
    pub g_base_vec: Vec<P>,
    pub g_base_compressed_vec: Vec<P::Compressed>,
    pub extension_degree: ExtensionDegree,
}
Expand description

Represents a pair of base points for Pedersen commitments

The Bulletproofs implementation and API is designed to support pluggable bases for Pedersen commitments, so that the choice of bases is not hard-coded.

The default generators are:

  • h_base: the curve basepoint;
  • g_base_vec: the result of domain separated SHA3-512 (hash of unique indexed strings) hash-to-group on input B_bytes.

Fields§

§h_base: P

Base for the committed value

§h_base_compressed: P::Compressed

Compressed base for the committed value

§g_base_vec: Vec<P>

Base for the blinding factor vector

§g_base_compressed_vec: Vec<P::Compressed>

Compressed base for the blinding factor vector

§extension_degree: ExtensionDegree

Blinding factor extension degree

Implementations§

source§

impl<P> PedersenGens<P>where P: Compressable,

source

pub fn h_base(&self) -> &P

Returns the non-public value base point

source

pub fn h_base_compressed(&self) -> P::Compressed

Returns the non-public value compressed base point

source§

impl<P> PedersenGens<P>where P: Compressable + MultiscalarMul<Point = P> + Clone,

source

pub fn commit<T>(&self, value: &T, blindings: &[T]) -> Result<P, ProofError>where for<'a> &'a T: Borrow<Scalar>,

Creates a Pedersen commitment using the value scalar and a blinding factor vector

Trait Implementations§

source§

impl<P: Clone + Compressable> Clone for PedersenGens<P>where P::Compressed: Clone,

source§

fn clone(&self) -> PedersenGens<P>

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<P: Debug + Compressable> Debug for PedersenGens<P>where P::Compressed: Debug,

source§

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

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

impl<P: PartialEq + Compressable> PartialEq<PedersenGens<P>> for PedersenGens<P>where P::Compressed: PartialEq,

source§

fn eq(&self, other: &PedersenGens<P>) -> 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<P: Compressable> StructuralPartialEq for PedersenGens<P>

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for PedersenGens<P>where P: RefUnwindSafe, <P as Compressable>::Compressed: RefUnwindSafe,

§

impl<P> Send for PedersenGens<P>where P: Send, <P as Compressable>::Compressed: Send,

§

impl<P> Sync for PedersenGens<P>where P: Sync, <P as Compressable>::Compressed: Sync,

§

impl<P> Unpin for PedersenGens<P>where P: Unpin, <P as Compressable>::Compressed: Unpin,

§

impl<P> UnwindSafe for PedersenGens<P>where P: UnwindSafe, <P as Compressable>::Compressed: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V