|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Functions | |
| template<typename Builder > | |
| field_t< Builder > | add_normalize_unsafe (const field_t< Builder > &a, const field_t< Builder > &b, size_t overflow_bits) |
| Compute (a + b) mod 2^32 with circuit constraints. | |
| field_t< Builder > bb::stdlib::hash_utils::add_normalize_unsafe | ( | const field_t< Builder > & | a, |
| const field_t< Builder > & | b, | ||
| size_t | overflow_bits | ||
| ) |
Compute (a + b) mod 2^32 with circuit constraints.
Given two field_t elements a and b, this function computes ((a + b) % 2^{32}). The overflow is constrained to fit within overflow_bits bits.
Constrains: result = a + b - overflow * 2^32, where overflow is range-checked to overflow_bits.
| a | First 32-bit operand (should be constrained externally). |
| b | Second 32-bit operand (should be constrained externally). |
| overflow_bits | Number of bits for overflow range constraint. Must accommodate max(a + b) / 2^32. For two 32-bit inputs, 1 bit suffices. For accumulated sums, use appropriately larger values. |
unsafe since the result is not explicitly range-constrained herein. If such range constraints are required, the caller must ensure they are applied, e.g. explicitly via create_range_constraint() or implicitly via downstream lookup tables that enforce the range. Definition at line 32 of file hash_utils.hpp.