Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::U256Codec Class Reference

#include <field_conversion.hpp>

Public Types

using DataType = uint256_t
 
using fr = bb::fr
 
using fq = grumpkin::fr
 
using bn254_point = curve::BN254::AffineElement
 
using grumpkin_point = curve::Grumpkin::AffineElement
 

Static Public Member Functions

template<typename T >
static constexpr size_t calc_num_fields ()
 
template<typename T >
static T deserialize_from_fields (std::span< const uint256_t > vec)
 
template<typename T >
static std::vector< uint256_tserialize_to_fields (const T &val)
 Conversion from transcript values to uint256_ts.
 
static std::array< uint256_t, 2 > split_challenge (const uint256_t &challenge)
 Split a challenge field element into two half-width challenges.
 
template<typename T >
static T convert_challenge (const bb::fr &challenge)
 Convert an fr challenge to a target type (fr or fq). Assumes challenge is "short".
 

Detailed Description

Definition at line 192 of file field_conversion.hpp.

Member Typedef Documentation

◆ bn254_point

◆ DataType

Definition at line 194 of file field_conversion.hpp.

◆ fq

Definition at line 196 of file field_conversion.hpp.

◆ fr

Definition at line 195 of file field_conversion.hpp.

◆ grumpkin_point

Member Function Documentation

◆ calc_num_fields()

template<typename T >
static constexpr size_t bb::U256Codec::calc_num_fields ( )
inlinestaticconstexpr

Definition at line 201 of file field_conversion.hpp.

◆ convert_challenge()

template<typename T >
static T bb::U256Codec::convert_challenge ( const bb::fr challenge)
inlinestatic

Convert an fr challenge to a target type (fr or fq). Assumes challenge is "short".

Definition at line 305 of file field_conversion.hpp.

◆ deserialize_from_fields()

template<typename T >
static T bb::U256Codec::deserialize_from_fields ( std::span< const uint256_t vec)
inlinestatic

Definition at line 217 of file field_conversion.hpp.

◆ serialize_to_fields()

template<typename T >
static std::vector< uint256_t > bb::U256Codec::serialize_to_fields ( const T &  val)
inlinestatic

Conversion from transcript values to uint256_ts.

Definition at line 251 of file field_conversion.hpp.

◆ split_challenge()

static std::array< uint256_t, 2 > bb::U256Codec::split_challenge ( const uint256_t challenge)
inlinestatic

Split a challenge field element into two half-width challenges.

lo is 128 bits and hi is 126 bits which should provide significantly more than our security parameter bound: 100 bits. The decomposition is constrained to be unique.

Parameters
challenge
Returns
std::array<uint256_t, 2>

Definition at line 290 of file field_conversion.hpp.


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