Struct secp256k1_zkp::PedersenCommitment
source · pub struct PedersenCommitment(/* private fields */);
Available on crate feature
std
only.Expand description
Represents a commitment to a single u64 value.
Implementations§
source§impl PedersenCommitment
impl PedersenCommitment
sourcepub fn serialize(&self) -> [u8; 33]
pub fn serialize(&self) -> [u8; 33]
Serialize a pedersen commitment.
The format of this serialization is stable and platform-independent.
sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
pub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
Parse a pedersen commitment from a byte slice.
sourcepub fn new<C: Signing>(
secp: &Secp256k1<C>,
value: u64,
blinding_factor: Tweak,
generator: Generator
) -> Self
pub fn new<C: Signing>( secp: &Secp256k1<C>, value: u64, blinding_factor: Tweak, generator: Generator ) -> Self
Create a new PedersenCommitment
that commits to the given value with
a certain blinding factor and generator.
Use the PedersenCommitment::new_unblinded for creating a commitment
using zero blinding factor.
sourcepub fn new_unblinded<C: Signing>(
secp: &Secp256k1<C>,
value: u64,
generator: Generator
) -> Self
pub fn new_unblinded<C: Signing>( secp: &Secp256k1<C>, value: u64, generator: Generator ) -> Self
Create a new PedersenCommitment
that commits to the given value
with a zero blinding factor and the Generator
.
Trait Implementations§
source§impl Clone for PedersenCommitment
impl Clone for PedersenCommitment
source§fn clone(&self) -> PedersenCommitment
fn clone(&self) -> PedersenCommitment
Returns a copy of the value. Read more
1.0.0 · 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
source§impl<'de> Deserialize<'de> for PedersenCommitment
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for PedersenCommitment
Available on crate feature
serde
only.source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for PedersenCommitment
impl Display for PedersenCommitment
source§impl FromStr for PedersenCommitment
impl FromStr for PedersenCommitment
source§impl Hash for PedersenCommitment
impl Hash for PedersenCommitment
source§impl LowerHex for PedersenCommitment
impl LowerHex for PedersenCommitment
source§impl Ord for PedersenCommitment
impl Ord for PedersenCommitment
source§fn cmp(&self, other: &PedersenCommitment) -> Ordering
fn cmp(&self, other: &PedersenCommitment) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for PedersenCommitment
impl PartialEq for PedersenCommitment
source§fn eq(&self, other: &PedersenCommitment) -> bool
fn eq(&self, other: &PedersenCommitment) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PedersenCommitment
impl PartialOrd for PedersenCommitment
source§fn partial_cmp(&self, other: &PedersenCommitment) -> Option<Ordering>
fn partial_cmp(&self, other: &PedersenCommitment) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for PedersenCommitment
Available on crate feature serde
only.
impl Serialize for PedersenCommitment
Available on crate feature
serde
only.impl Copy for PedersenCommitment
impl Eq for PedersenCommitment
impl StructuralEq for PedersenCommitment
impl StructuralPartialEq for PedersenCommitment
Auto Trait Implementations§
impl RefUnwindSafe for PedersenCommitment
impl Send for PedersenCommitment
impl Sync for PedersenCommitment
impl Unpin 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