pub struct PedersenCommitment {
pub point: RistrettoPoint,
pub compressed: CompressedRistretto,
}Expand description
A Pedersen commitment.
Fields§
§point: RistrettoPointThe commitment point C = rG + vH.
compressed: CompressedRistrettoThe compressed (serialized) form.
Implementations§
Source§impl PedersenCommitment
impl PedersenCommitment
Sourcepub fn commit(
params: &PedersenParams,
value: &Scalar,
) -> (Self, PedersenOpening)
pub fn commit( params: &PedersenParams, value: &Scalar, ) -> (Self, PedersenOpening)
Commit to a value with a random blinding factor.
Sourcepub fn commit_with_randomness(
params: &PedersenParams,
value: &Scalar,
randomness: &Scalar,
) -> Self
pub fn commit_with_randomness( params: &PedersenParams, value: &Scalar, randomness: &Scalar, ) -> Self
Commit to a value with a specific blinding factor.
Sourcepub fn verify(
params: &PedersenParams,
opening: &PedersenOpening,
commitment: &PedersenCommitment,
) -> bool
pub fn verify( params: &PedersenParams, opening: &PedersenOpening, commitment: &PedersenCommitment, ) -> bool
Verify an opening against this commitment.
Sourcepub fn commit_u64(
params: &PedersenParams,
value: u64,
) -> (Self, PedersenOpening)
pub fn commit_u64( params: &PedersenParams, value: u64, ) -> (Self, PedersenOpening)
Create a commitment from a u64 value.
Sourcepub fn add(&self, other: &PedersenCommitment) -> PedersenCommitment
pub fn add(&self, other: &PedersenCommitment) -> PedersenCommitment
Add two commitments homomorphically: C1 + C2 commits to v1 + v2.
Trait Implementations§
Source§impl Clone for PedersenCommitment
impl Clone for PedersenCommitment
Source§fn clone(&self) -> PedersenCommitment
fn clone(&self) -> PedersenCommitment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PedersenCommitment
impl Debug for PedersenCommitment
impl Eq for PedersenCommitment
Source§impl PartialEq for PedersenCommitment
impl PartialEq for PedersenCommitment
Source§fn eq(&self, other: &PedersenCommitment) -> bool
fn eq(&self, other: &PedersenCommitment) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PedersenCommitment
Auto Trait Implementations§
impl Freeze for PedersenCommitment
impl RefUnwindSafe for PedersenCommitment
impl Send for PedersenCommitment
impl Sync for PedersenCommitment
impl Unpin for PedersenCommitment
impl UnsafeUnpin for PedersenCommitment
impl UnwindSafe for PedersenCommitment
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