pub struct Commitment(/* private fields */);Expand description
A binding, hiding commitment to a Contribution. Public.
Compared with plain ==: both sides are public values, so timing leaks
nothing. Debug and Display print lowercase hex.
Implementations§
Source§impl Commitment
impl Commitment
Sourcepub const fn from_bytes(bytes: [u8; 32]) -> Self
pub const fn from_bytes(bytes: [u8; 32]) -> Self
Wraps raw digest bytes. Used by the other commitment constructors in this module; a caller has no reason to build one by hand.
Sourcepub fn from_hex(s: &str) -> Result<Self, CardError>
pub fn from_hex(s: &str) -> Result<Self, CardError>
Parses 64 hex digits of either case.
§Errors
CardError::InvalidHex with the offending input on wrong length or
a non-hex character.
Sourcepub fn verify(&self, c: &Contribution) -> bool
pub fn verify(&self, c: &Contribution) -> bool
Recompute the commitment of c and compare.
Trait Implementations§
Source§impl Clone for Commitment
impl Clone for Commitment
impl Copy for Commitment
Source§impl Debug for Commitment
impl Debug for Commitment
Source§impl<'de> Deserialize<'de> for Commitment
impl<'de> Deserialize<'de> for Commitment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Commitment
impl Display for Commitment
impl Eq for Commitment
Source§impl Hash for Commitment
impl Hash for Commitment
Source§impl PartialEq for Commitment
impl PartialEq for Commitment
Source§impl Serialize for Commitment
impl Serialize for Commitment
impl StructuralPartialEq for Commitment
Auto Trait Implementations§
impl Freeze for Commitment
impl RefUnwindSafe for Commitment
impl Send for Commitment
impl Sync for Commitment
impl Unpin for Commitment
impl UnsafeUnpin for Commitment
impl UnwindSafe for Commitment
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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