Skip to main content

Mode

Trait Mode 

Source
pub trait Mode: 'static {
    const BLINDING: bool;

    // Required methods
    fn sample<F: Field>() -> F;
    fn mask<G: Group>(value: G, base: &G, blind: &G::Scalar) -> G;
}
Expand description

Determines whether protocol messages are blinded (ZK) or unblinded (transparent).

Required Associated Constants§

Source

const BLINDING: bool

Whether this mode produces blinding values that callers must retain.

Required Methods§

Source

fn sample<F: Field>() -> F

Sample a blinding scalar: zero in Transparent mode, random in ZK mode.

Source

fn mask<G: Group>(value: G, base: &G, blind: &G::Scalar) -> G

Mask a group element: identity in Transparent mode, value + base * blind in ZK mode.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Mode for Transparent

Source§

const BLINDING: bool = false

Source§

impl Mode for ZK

Available on crate feature zk only.
Source§

const BLINDING: bool = true