Struct snarkvm_circuit::BHP

source ·
pub struct BHP<E, const NUM_WINDOWS: u8, const WINDOW_SIZE: u8>where
    E: Environment,
{ /* private fields */ }
Expand description

BHP is a collision-resistant hash function that takes a variable-length input. The BHP hash function does not behave like a random oracle, see Poseidon for one.

Design

The BHP hash function splits the given input into blocks, and processes them iteratively.

The first iteration is initialized as follows:

DIGEST_0 = BHP([ 0...0 || DOMAIN || LENGTH(INPUT) || INPUT[0..BLOCK_SIZE] ]);

Each subsequent iteration is initialized as follows:

DIGEST_N+1 = BHP([ DIGEST_N[0..DATA_BITS] || INPUT[(N+1)*BLOCK_SIZE..(N+2)*BLOCK_SIZE] ]);

Trait Implementations

Returns the BHP commitment of the given input and randomizer as a field element.

Returns the BHP commitment of the given input and randomizer as an affine group element.

Returns the BHP hash of the given input as a field element.

Returns the BHP hash of the given input as an affine group element.

This uncompressed variant of the BHP hash function is provided to support the BHP commitment scheme, as it is typically not used by applications.

Initializes a new instance of a BHP circuit with the given BHP variant.

Initializes a constant of the given primitive value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.