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§
Sourceconst IS_HIDING: bool
const IS_HIDING: bool
CommitmentDef::IS_HIDING indicates whether the commitment scheme has
the hiding property.
Required Associated Types§
Sourcetype Key: CommitmentKey
type Key: CommitmentKey
CommitmentDef::Key is the type of the commitment key.
Sourcetype Scalar: Clone + Copy + Default + Debug + PartialEq + Eq + Sync + Absorbable + UniformRand
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.
Sourcetype Commitment: Clone + Default + Debug + PartialEq + Eq + Sync + Absorbable
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.
Sourcetype 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
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".