Trait snarkvm_algorithms::traits::commitment::CommitmentScheme[][src]

pub trait CommitmentScheme: Sized + Clone + From<Self::Parameters> {
    type Output: Clone + Debug + Default + Eq + Hash + ToBytes + FromBytes;
    type Parameters: Clone + Debug + Eq + ToBytes + FromBytes;
    type Randomness: Clone + Debug + Default + Eq + UniformRand + ToBytes + FromBytes;
    fn setup<R: Rng>(r: &mut R) -> Self;
fn commit(
        &self,
        input: &[u8],
        randomness: &Self::Randomness
    ) -> Result<Self::Output, CommitmentError>;
fn parameters(&self) -> &Self::Parameters; }

Associated Types

Required methods

fn setup<R: Rng>(r: &mut R) -> Self[src]

fn commit(
    &self,
    input: &[u8],
    randomness: &Self::Randomness
) -> Result<Self::Output, CommitmentError>
[src]

fn parameters(&self) -> &Self::Parameters[src]

Implementors

impl CommitmentScheme for Blake2sCommitment[src]

type Output = [u8; 32]

type Parameters = ()

type Randomness = [u8; 32]

fn setup<R: Rng>(_: &mut R) -> Self[src]

fn commit(
    &self,
    input: &[u8],
    randomness: &Self::Randomness
) -> Result<Self::Output, CommitmentError>
[src]

fn parameters(&self) -> &Self::Parameters[src]

impl<G: Group + ProjectiveCurve, S: PedersenSize> CommitmentScheme for PedersenCompressedCommitment<G, S>[src]

fn commit(
    &self,
    input: &[u8],
    randomness: &Self::Randomness
) -> Result<Self::Output, CommitmentError>
[src]

Returns the affine x-coordinate as the commitment.

type Output = <G::Affine as AffineCurve>::BaseField

type Parameters = PedersenCommitmentParameters<G, S>

type Randomness = <G as Group>::ScalarField

fn setup<R: Rng>(rng: &mut R) -> Self[src]

fn parameters(&self) -> &Self::Parameters[src]

impl<G: Group, S: PedersenSize> CommitmentScheme for PedersenCommitment<G, S>[src]

type Output = G

type Parameters = PedersenCommitmentParameters<G, S>

type Randomness = G::ScalarField

fn setup<R: Rng>(rng: &mut R) -> Self[src]

fn commit(
    &self,
    input: &[u8],
    randomness: &Self::Randomness
) -> Result<Self::Output, CommitmentError>
[src]

fn parameters(&self) -> &Self::Parameters[src]