pub struct Pedersen;
Expand description
Algorithm handle for the Pedersen commitment scheme.
Implementations§
Source§impl Pedersen
impl Pedersen
Sourcepub fn new<T: Into<Scalar>>(amount: T) -> (PedersenCommitment, PedersenOpening)
pub fn new<T: Into<Scalar>>(amount: T) -> (PedersenCommitment, PedersenOpening)
On input a message (numeric amount), the function returns a Pedersen commitment of the message and the corresponding opening.
This function is randomized. It internally samples a Pedersen opening using OsRng
.
Sourcepub fn with<T: Into<Scalar>>(
amount: T,
opening: &PedersenOpening,
) -> PedersenCommitment
pub fn with<T: Into<Scalar>>( amount: T, opening: &PedersenOpening, ) -> PedersenCommitment
On input a message (numeric amount) and a Pedersen opening, the function returns the corresponding Pedersen commitment.
This function is deterministic.
Sourcepub fn encode<T: Into<Scalar>>(amount: T) -> PedersenCommitment
pub fn encode<T: Into<Scalar>>(amount: T) -> PedersenCommitment
On input a message (numeric amount), the function returns a Pedersen commitment with zero as the opening.
This function is deterministic.
Auto Trait Implementations§
impl Freeze for Pedersen
impl RefUnwindSafe for Pedersen
impl Send for Pedersen
impl Sync for Pedersen
impl Unpin for Pedersen
impl UnwindSafe for Pedersen
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> 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