Struct safe_zk_token_sdk::encryption::pedersen::Pedersen
source · 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,
open: &PedersenOpening
) -> PedersenCommitment
pub fn with<T: Into<Scalar>>( amount: T, open: &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.