|
purify
C++ Purify implementation with native circuit and BPP support
|
Elliptic-curve helpers, fixed parameters, and hash-to-curve utilities for Purify. More...
#include "purify/numeric.hpp"Go to the source code of this file.
Data Structures | |
| struct | purify::JacobianPoint |
| Jacobian point representation used for curve arithmetic. More... | |
| struct | purify::AffinePoint |
| Affine point representation used for serialization and lookup tables. More... | |
| struct | purify::CompleteProjectivePoint |
| Projective point used by the hardened secret-scalar multiplication path. More... | |
| class | purify::EllipticCurve |
| Minimal elliptic-curve arithmetic over the Purify base field. More... | |
| class | purify::TaggedHash |
| Reusable BIP340-style tagged SHA-256 helper. More... | |
Namespaces | |
| namespace | purify |
Functions | |
| Bytes | purify::bytes_from_ascii (std::string_view input) |
| Encodes an ASCII string as a byte vector. | |
| Bytes | purify::operator+ (Bytes lhs, const Bytes &rhs) |
| Concatenates two byte vectors. | |
| std::uint64_t | purify::ceil_div (std::uint64_t lhs, std::uint64_t rhs) |
| Computes ceiling division for unsigned 64-bit values. | |
| Bytes | purify::hmac_sha256 (const Bytes &key, const Bytes &data) |
| Computes an HMAC-SHA256 digest using the secp bridge implementation. | |
| Bytes | purify::hkdf (std::size_t length, const Bytes &ikm, const Bytes &salt={}, const Bytes &info={}) |
| Expands input key material using HKDF-SHA256. | |
| template<std::size_t Words> | |
| std::optional< BigUInt< Words > > | purify::hash_to_int (const Bytes &data, const BigUInt< Words > &range, const Bytes &info={}) |
Rejection-samples a uniformly distributed integer below range. | |
| template<std::size_t Words> | |
| std::optional< BigUInt< Words > > | purify::tagged_hash_to_int (std::span< const unsigned char > data, const BigUInt< Words > &range, const TaggedHash &tag, std::span< const unsigned char > info={}) |
Rejection-samples a uniformly distributed integer below range using repeated tagged hashes. | |
| const UInt256 & | purify::order_n1 () |
| Returns the subgroup order for the first curve. | |
| const UInt256 & | purify::order_n2 () |
| Returns the subgroup order for the second curve. | |
| const UInt256 & | purify::half_n1 () |
Returns floor(order_n1 / 2). | |
| const UInt256 & | purify::half_n2 () |
Returns floor(order_n2 / 2). | |
| const UInt512 & | purify::packed_secret_key_space_size () |
| Returns the size of the packed secret-key encoding space. | |
| const UInt512 & | purify::packed_public_key_space_size () |
| Returns the size of the packed public-key encoding space. | |
| const UInt320 & | purify::two_p () |
Returns 2 * prime_p() as a widened integer for hash-to-curve sampling. | |
| FieldElement | purify::field_a () |
Returns the shared Weierstrass a coefficient used by Purify. | |
| FieldElement | purify::field_b () |
Returns the shared Weierstrass b coefficient used by Purify. | |
| FieldElement | purify::field_d () |
| Returns the twist factor used to derive the second curve. | |
| FieldElement | purify::field_di () |
| Returns the inverse of the twist factor in the field. | |
| const EllipticCurve & | purify::curve1 () |
| Returns the first Purify curve instance. | |
| const EllipticCurve & | purify::curve2 () |
| Returns the second Purify curve instance. | |
| Result< JacobianPoint > | purify::hash_to_curve (const Bytes &data, const EllipticCurve &curve) |
| Hashes arbitrary data onto the supplied curve by rejection sampling x-coordinates. | |
| const JacobianPoint & | purify::generator1 () |
| Returns the fixed generator for the first curve. | |
| const JacobianPoint & | purify::generator2 () |
| Returns the fixed generator for the second curve. | |
| bool | purify::is_valid_secret_key (const UInt512 &z) |
| Returns true when a packed secret is encoded canonically. | |
| bool | purify::is_valid_public_key (const UInt512 &packed) |
| Returns true when a packed public key is encoded canonically. | |
| Status | purify::validate_secret_key (const UInt512 &z) |
| Validates the packed secret-key encoding range. | |
| Status | purify::validate_public_key (const UInt512 &packed) |
| Validates the packed public-key encoding range. | |
| Result< std::pair< UInt256, UInt256 > > | purify::unpack_secret (const UInt512 &z) |
| Splits a packed private key into its two per-curve secret scalars. | |
| Result< std::pair< UInt256, UInt256 > > | purify::unpack_public (const UInt512 &packed) |
| Splits a packed public key into its two x-coordinates. | |
| UInt512 | purify::pack_public (const UInt256 &x1, const UInt256 &x2) |
| Packs two x-coordinates into the reference 512-bit public-key encoding. | |
| FieldElement | purify::combine (const FieldElement &x1, const FieldElement &x2) |
| Applies the Purify curve-combination map to two x-coordinates. | |
| Result< std::vector< int > > | purify::key_to_bits (UInt256 n, const UInt256 &max_value) |
| Encodes a scalar into the signed 3-bit window bit schedule used by the circuit. | |