Skip to main content

CommitmentDef

Trait CommitmentDef 

Source
pub trait CommitmentDef:
    'static
    + Clone
    + Debug
    + PartialEq
    + Eq {
    type Key: CommitmentKey;
    type Scalar: Clone + Copy + Default + Debug + PartialEq + Eq + Sync + Absorbable + UniformRand;
    type Commitment: Clone + Default + Debug + PartialEq + Eq + Sync + Absorbable;
    type Randomness: Clone + Copy + Default + Debug + PartialEq + Eq + Sync + Add<Self::Scalar, Output = Self::Randomness> + Mul<Self::Scalar, Output = Self::Randomness> + for<'a> Add<&'a Self::Scalar, Output = Self::Randomness> + for<'a> Mul<&'a Self::Scalar, Output = Self::Randomness> + Add<Output = Self::Randomness> + Mul<Output = Self::Randomness> + Sum;

    const IS_HIDING: bool;
}
Expand description

CommitmentDef provides the core type definitions of a commitment scheme, defining the types of relevant cryptographic objects such as the commitment key, scalars, commitments, and randomness.

Required Associated Constants§

Source

const IS_HIDING: bool

CommitmentDef::IS_HIDING indicates whether the commitment scheme has the hiding property.

Required Associated Types§

Source

type Key: CommitmentKey

CommitmentDef::Key is the type of the commitment key.

Source

type Scalar: Clone + Copy + Default + Debug + PartialEq + Eq + Sync + Absorbable + UniformRand

CommitmentDef::Scalar is the type of the scalars being committed to.

For generality, we do not restrict this to field elements and instead only bound it by necessary traits.

Source

type Commitment: Clone + Default + Debug + PartialEq + Eq + Sync + Absorbable

CommitmentDef::Commitment is the type of the commitment.

In the future we may introduce other commitment schemes such as those based on hash functions or lattices, so we do not restrict this to be group elements.

Source

type Randomness: Clone + Copy + Default + Debug + PartialEq + Eq + Sync + Add<Self::Scalar, Output = Self::Randomness> + Mul<Self::Scalar, Output = Self::Randomness> + for<'a> Add<&'a Self::Scalar, Output = Self::Randomness> + for<'a> Mul<&'a Self::Scalar, Output = Self::Randomness> + Add<Output = Self::Randomness> + Mul<Output = Self::Randomness> + Sum

CommitmentDef::Randomness is the type of the randomness used in the commitment.

Hiding commitment schemes and non-hiding schemes may have different randomness types, e.g., the former holds real data, while the latter is just a placeholder type.

In this way, we can leverage the compiler to reject misuse, e.g., using randomness where it is not needed, or vice versa, with a unified API.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§