Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::stdlib::pedersen_hash< Builder > Class Template Reference

stdlib class that evaluates in-circuit pedersen hashes, consistent with behavior in crypto::pedersen_hash More...

#include <pedersen.hpp>

Static Public Member Functions

static field_ct hash (const std::vector< field_ct > &in, GeneratorContext context={})
 Computes a pedersen hash of the provided inputs.
 

Private Types

using field_ct = stdlib::field_t< Builder >
 
using bool_t = stdlib::bool_t< Builder >
 
using EmbeddedCurve = typename cycle_group< Builder >::Curve
 
using GeneratorContext = crypto::GeneratorContext< EmbeddedCurve >
 
using cycle_group = stdlib::cycle_group< Builder >
 

Detailed Description

template<typename Builder>
class bb::stdlib::pedersen_hash< Builder >

stdlib class that evaluates in-circuit pedersen hashes, consistent with behavior in crypto::pedersen_hash

Template Parameters
Builder

Definition at line 23 of file pedersen.hpp.

Member Typedef Documentation

◆ bool_t

template<typename Builder >
using bb::stdlib::pedersen_hash< Builder >::bool_t = stdlib::bool_t<Builder>
private

Definition at line 27 of file pedersen.hpp.

◆ cycle_group

template<typename Builder >
using bb::stdlib::pedersen_hash< Builder >::cycle_group = stdlib::cycle_group<Builder>
private

Definition at line 30 of file pedersen.hpp.

◆ EmbeddedCurve

template<typename Builder >
using bb::stdlib::pedersen_hash< Builder >::EmbeddedCurve = typename cycle_group<Builder>::Curve
private

Definition at line 28 of file pedersen.hpp.

◆ field_ct

Definition at line 26 of file pedersen.hpp.

◆ GeneratorContext

template<typename Builder >
using bb::stdlib::pedersen_hash< Builder >::GeneratorContext = crypto::GeneratorContext<EmbeddedCurve>
private

Definition at line 29 of file pedersen.hpp.

Member Function Documentation

◆ hash()

template<typename Builder >
field_t< Builder > bb::stdlib::pedersen_hash< Builder >::hash ( const std::vector< field_ct > &  inputs,
GeneratorContext  context = {} 
)
static

Computes a pedersen hash of the provided inputs.

The pedersen hash is computed as the x-coordinate of the point: P = \sum_i inputs[i] * G_i + len * H, where G_i and H are generator points of the Grumpkin curve and len is the number of inputs. The len * H term is included to avoid the trivial collision that otherwise results from negating all inputs. See crypto::pedersen_hash for more details.

Note
: The inputs are elements of the bn254 scalar field but are interpreted as scalars in the Grumpkin scalar field (represented by cycle_scalar).
Template Parameters
Builder
Parameters
inputsThe field elements to be hashed
context(optional) context for generator selection/construction
Returns
field_t<Builder> The x-coordinate of the resulting pedersen hash point

Definition at line 29 of file pedersen.cpp.


The documentation for this class was generated from the following files: