Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
hash.hpp
Go to the documentation of this file.
1
// === AUDIT STATUS ===
2
// internal: { status: Planned, auditors: [Raju], commit: }
3
// external_1: { status: not started, auditors: [], commit: }
4
// external_2: { status: not started, auditors: [], commit: }
5
// =====================
6
7
#pragma once
8
#include "
barretenberg/crypto/pedersen_hash/pedersen.hpp
"
9
#include "
barretenberg/crypto/poseidon2/poseidon2.hpp
"
10
#include <vector>
11
12
namespace
bb::crypto::merkle_tree
{
13
14
struct
PedersenHashPolicy
{
15
static
fr
hash
(
const
std::vector<fr>&
inputs
) {
return
crypto::pedersen_hash::hash
(
inputs
); }
16
17
static
fr
hash_pair
(
const
fr
& lhs,
const
fr
& rhs) {
return
hash
(std::vector<fr>({ lhs, rhs })); }
18
19
static
fr
zero_hash
() {
return
fr::zero
(); }
20
};
21
22
struct
Poseidon2HashPolicy
{
23
static
fr
hash
(
const
std::vector<fr>&
inputs
)
24
{
25
return
bb::crypto::Poseidon2<bb::crypto::Poseidon2Bn254ScalarFieldParams>::hash
(
inputs
);
26
}
27
28
static
fr
hash_pair
(
const
fr
& lhs,
const
fr
& rhs) {
return
hash
(std::vector<fr>({ lhs, rhs })); }
29
30
static
fr
zero_hash
() {
return
fr::zero
(); }
31
};
32
33
}
// namespace bb::crypto::merkle_tree
bb::crypto::Poseidon2::hash
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
bb::crypto::pedersen_hash_base::hash
static Fq hash(const std::vector< Fq > &inputs, GeneratorContext context={})
Given a vector of fields, generate a pedersen hash using generators from context.
Definition
pedersen.cpp:78
poseidon2.hpp
inputs
AvmProvingInputs inputs
Definition
hinting_dbs.test.cpp:45
bb::crypto::merkle_tree
Definition
content_addressed_append_only_tree.hpp:33
pedersen.hpp
bb::crypto::merkle_tree::PedersenHashPolicy
Definition
hash.hpp:14
bb::crypto::merkle_tree::PedersenHashPolicy::hash_pair
static fr hash_pair(const fr &lhs, const fr &rhs)
Definition
hash.hpp:17
bb::crypto::merkle_tree::PedersenHashPolicy::zero_hash
static fr zero_hash()
Definition
hash.hpp:19
bb::crypto::merkle_tree::PedersenHashPolicy::hash
static fr hash(const std::vector< fr > &inputs)
Definition
hash.hpp:15
bb::crypto::merkle_tree::Poseidon2HashPolicy
Definition
hash.hpp:22
bb::crypto::merkle_tree::Poseidon2HashPolicy::hash_pair
static fr hash_pair(const fr &lhs, const fr &rhs)
Definition
hash.hpp:28
bb::crypto::merkle_tree::Poseidon2HashPolicy::zero_hash
static fr zero_hash()
Definition
hash.hpp:30
bb::crypto::merkle_tree::Poseidon2HashPolicy::hash
static fr hash(const std::vector< fr > &inputs)
Definition
hash.hpp:23
bb::field< Bn254FrParams >
bb::field< Bn254FrParams >::zero
static constexpr field zero()
Definition
field_declarations.hpp:242
src
barretenberg
crypto
merkle_tree
hash.hpp
Generated by
1.9.8