|
barretenberg
|
Public Types | |
| using | in_buf = const uint8_t * |
| using | vec_in_buf = const uint8_t * |
| using | out_buf = uint8_t * |
| using | vec_out_buf = uint8_t ** |
Public Member Functions | |
| constexpr | affine_element (const Fq &a, const Fq &b) noexcept |
| constexpr | affine_element (const affine_element &other) noexcept=default |
| constexpr | affine_element (affine_element &&other) noexcept=default |
| constexpr affine_element & | operator= (const affine_element &other) noexcept=default |
| constexpr affine_element & | operator= (affine_element &&other) noexcept=default |
| constexpr affine_element | operator+ (const affine_element &other) const noexcept |
| template<typename BaseField = Fq, typename CompileTimeEnabled = std::enable_if_t<(BaseField::modulus >> 255) == uint256_t(0), void>> | |
| constexpr uint256_t | compress () const noexcept |
| constexpr affine_element | set_infinity () const noexcept |
| constexpr void | self_set_infinity () noexcept |
| constexpr bool | is_point_at_infinity () const noexcept |
| constexpr bool | on_curve () const noexcept |
| constexpr bool | operator== (const affine_element &other) const noexcept |
| constexpr affine_element | operator- () const noexcept |
| constexpr bool | operator> (const affine_element &other) const noexcept |
| constexpr bool | operator< (const affine_element &other) const noexcept |
| std::vector< uint8_t > | to_buffer () const |
| Serialize the point to a byte vector. | |
| MSGPACK_FIELDS (x, y) | |
| template<typename BaseField , typename CompileTimeEnabled > | |
| constexpr affine_element< Fq, Fr, T > | from_compressed (const uint256_t &compressed) noexcept |
| template<typename BaseField , typename CompileTimeEnabled > | |
| constexpr std::array< affine_element< Fq, Fr, T >, 2 > | from_compressed_unsafe (const uint256_t &compressed) noexcept |
Static Public Member Functions | |
| static constexpr affine_element | one () noexcept |
| template<typename BaseField = Fq, typename CompileTimeEnabled = std::enable_if_t<(BaseField::modulus >> 255) == uint256_t(0), void>> | |
| static constexpr affine_element | from_compressed (const uint256_t &compressed) noexcept |
| Reconstruct a point in affine coordinates from compressed form. | |
| template<typename BaseField = Fq, typename CompileTimeEnabled = std::enable_if_t<(BaseField::modulus >> 255) == uint256_t(1), void>> | |
| static constexpr std::array< affine_element, 2 > | from_compressed_unsafe (const uint256_t &compressed) noexcept |
| Reconstruct a point in affine coordinates from compressed form. | |
| static affine_element | infinity () |
| static constexpr std::optional< affine_element > | derive_from_x_coordinate (const Fq &x, bool sign_bit) noexcept |
| static affine_element | random_element (numeric::random::Engine *engine=nullptr) noexcept |
| Samples a random point on the curve. | |
| static constexpr affine_element | hash_to_curve (const std::vector< uint8_t > &seed, uint8_t attempt_count=0) noexcept |
| Hash a seed buffer into a point. | |
| static void | serialize_to_buffer (const affine_element &value, uint8_t *buffer) |
| Serialize the point to the given buffer. | |
| static affine_element | serialize_from_buffer (uint8_t *buffer) |
| Restore point from a buffer. | |
Public Attributes | |
| Fq | x |
| Fq | y |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const affine_element &a) |
|
staticconstexprnoexcept |
Reconstruct a point in affine coordinates from compressed form.
#LARGE_MODULUS_AFFINE_POINT_COMPRESSION Point compression is only implemented for curves of a prime field F_p with p using < 256 bits. One possiblity for extending to a 256-bit prime field: https://patents.google.com/patent/US6252960B1/en.
| compressed | compressed point |
|
staticconstexprnoexcept |
Reconstruct a point in affine coordinates from compressed form.
#LARGE_MODULUS_AFFINE_POINT_COMPRESSION Point compression is implemented for curves of a prime field F_p with p being 256 bits. TODO(Suyash): Check with kesha if this is correct.
| compressed | compressed point |
|
staticconstexprnoexcept |
Hash a seed buffer into a point.
ALGORITHM DESCRIPTION:
attempt_count = 0seed (initialized to 0)attempt_count as a byte and write into buffer at [buffer.size() - 2]1attempt_count by 1 and go to step 2| Fq | |
| Fr | |
| T |
| seed | Bytes that uniquely define the point being generated |
| attempt_count |
|
constexprnoexcept |
Comparison operators (for std::sort)
CAUTION!! Don't use this operator. It has no meaning other than for use by std::sort.
|
staticnoexcept |
Samples a random point on the curve.
|
inlinestatic |
Restore point from a buffer.
| buffer | Buffer from which we deserialize the point |
We support serializing the point at infinity for curves defined over a barretenberg::field (i.e., a native field of prime order) and for points of barretenberg::g2.
|
inlinestatic |
Serialize the point to the given buffer.
We support serializing the point at infinity for curves defined over a barretenberg::field (i.e., a native field of prime order) and for points of barretenberg::g2.
|
inline |
Serialize the point to a byte vector.