|
barretenberg
|
Constructs a packed buffer of field elements to be fed into a Pedersen hash function Goal is to concatenate multiple inputs together into a single field element if the inputs are known to be small. Produces a vector of field elements where the maximum number of bits per element is bits_per_element.
More...
#include <verification_key.hpp>
Public Types | |
| using | field_pt = field_t< Builder > |
| using | witness_pt = witness_t< Builder > |
Public Member Functions | |
| PedersenPreimageBuilder (Builder *ctx=nullptr) | |
| field_pt | hash () |
| void | add_element (const field_pt &element) |
| void | add_element_with_existing_range_constraint (const field_pt &element, const size_t num_bits) |
| void | slice_element (const field_pt &element, const size_t num_bits) |
Populate preimage_data with element whose size is known to be num_bits. preimage_data is treated as a bit-array where bits_per_element number of bits are packed into a single field element. slice_element will: | |
Public Attributes | |
| Builder * | context |
| std::vector< field_pt > | preimage_data |
preimage_data is a bit-array where bits_per_element number of bits are packed into a single field element | |
| std::vector< field_pt > | work_element |
work_element represents the leading element to be added into preimage_data. Vector is composed of field elements that represent bit chunks of a known length, such that the sum of the bit chunks < bits_per_element | |
| size_t | current_bit_counter = 0 |
Constructs a packed buffer of field elements to be fed into a Pedersen hash function Goal is to concatenate multiple inputs together into a single field element if the inputs are known to be small. Produces a vector of field elements where the maximum number of bits per element is bits_per_element.
When calling pedersen::hash on the final buffer, we can skip the range checks normally performed in the hash method, because we know the sums of the scalar slices cannot exceed the field modulus. This requires bits_per_element < modulus bits
| Builder | |
| bits_per_element |
|
inline |
Populate preimage_data with element whose size is known to be num_bits. preimage_data is treated as a bit-array where bits_per_element number of bits are packed into a single field element. slice_element will:
element into 2 chunks hi/lohi chunk (or the full element if possible)preimage_datalo| element | |
| num_bits |