pub trait CommitmentOps: CommitmentDef {
// Required methods
fn generate_key(len: usize, rng: impl RngCore) -> Result<Self::Key, Error>;
fn commit(
ck: &Self::Key,
v: &[Self::Scalar],
rng: impl RngCore,
) -> Result<(Self::Commitment, Self::Randomness), Error>;
fn open(
ck: &Self::Key,
v: &[Self::Scalar],
r: &Self::Randomness,
cm: &Self::Commitment,
) -> Result<(), Error>;
}Expand description
CommitmentOps defines algorithms for commitment schemes.
Required Methods§
Sourcefn generate_key(len: usize, rng: impl RngCore) -> Result<Self::Key, Error>
fn generate_key(len: usize, rng: impl RngCore) -> Result<Self::Key, Error>
CommitmentOps::generate_key defines the key generation algorithm,
which is a randomized algorithm that takes as input the maximum length
len of supported messages, and a randomness source rng, and outputs
the commitment key.
Sourcefn commit(
ck: &Self::Key,
v: &[Self::Scalar],
rng: impl RngCore,
) -> Result<(Self::Commitment, Self::Randomness), Error>
fn commit( ck: &Self::Key, v: &[Self::Scalar], rng: impl RngCore, ) -> Result<(Self::Commitment, Self::Randomness), Error>
CommitmentOps::commit defines the commitment generation algorithm,
which is a (probably) randomized algorithm that takes as input
commitment key ck, a vector of scalars v to be committed to, and a
randomness source rng, and outputs the commitment and the randomness.
Sourcefn open(
ck: &Self::Key,
v: &[Self::Scalar],
r: &Self::Randomness,
cm: &Self::Commitment,
) -> Result<(), Error>
fn open( ck: &Self::Key, v: &[Self::Scalar], r: &Self::Randomness, cm: &Self::Commitment, ) -> Result<(), Error>
CommitmentOps::open defines the commitment opening algorithm, which
is a deterministic algorithm that takes as input commitment key ck,
a vector of scalars v, the randomness r, and a commitment cm, and
outputs Ok(()) if the opening verifies, or an error otherwise.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".