Trait prio::idpf::IdpfValue

source ·
pub trait IdpfValue: Add<Output = Self> + AddAssign + Sub<Output = Self> + ConditionallyNegatable + Encode + ParameterizedDecode<Self::ValueParameter> + Sized {
    type ValueParameter;

    // Required methods
    fn generate<S>(
        seed_stream: &mut S,
        parameter: &Self::ValueParameter
    ) -> Self
       where S: RngCore;
    fn zero(parameter: &Self::ValueParameter) -> Self;
    fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self;
}
Available on crate features crypto-dependencies and experimental only.
Expand description

Trait for values to be programmed into an IDPF.

Values must form an Abelian group, so that they can be secret-shared, and the group operation must be represented by Add. Values must be encodable and decodable, without need for a decoding parameter. Values can be pseudorandomly generated, with a uniform probability distribution, from XOF output.

Required Associated Types§

source

type ValueParameter

Any run-time parameters needed to produce a value.

Required Methods§

source

fn generate<S>(seed_stream: &mut S, parameter: &Self::ValueParameter) -> Self
where S: RngCore,

Generate a pseudorandom value from a seed stream.

source

fn zero(parameter: &Self::ValueParameter) -> Self

Returns the additive identity.

source

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Conditionally select between two values. Implementations must perform this operation in constant time.

This is the same as in subtle::ConditionallySelectable, but without the Copy bound.

Object Safety§

This trait is not object safe.

Implementors§