1#ifdef STARKNET_GARAGA_FLAVORS
11 using Poseidon = crypto::Poseidon<crypto::PoseidonStark252BaseFieldParams>;
12 using FF = Poseidon::FF;
14 size_t elem_count =
data.size();
15 std::vector<FF> elems(2 * (1 + elem_count));
17 elems[0] =
FF(std::string(
"0x0000000000000000000000000000000000000000537461726b6e6574486f6e6b"));
20 for (
size_t k = 0; k < elem_count; ++k) {
23 std::array<uint8_t, 32> limb_lo = {};
24 std::array<uint8_t, 32> limb_hi = {};
26 for (
size_t i = 16; i < 32; ++i) {
27 limb_hi[i] = input[i - 16];
28 limb_lo[i] = input[i];
31 elems[2 * (1 + k)] = from_buffer<FF>(limb_lo);
32 elems[2 * (1 + k) + 1] = from_buffer<FF>(limb_hi);
37 FF output = Poseidon::hash(elems, iv);
39 std::vector<uint8_t> result =
to_buffer(output);
41 auto result_fr = from_buffer<bb::fr>(result);
47 static inline Fr hash(
const std::vector<Fr>&
data) {
return starknet_hash_uint256(
data); }
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
const std::vector< FF > data
void hash(State &state) noexcept
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< uint8_t > to_buffer(T const &value)