Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::crypto::detail::x25519 Namespace Reference

Typedefs

using Fe = std::array< int32_t, 10 >
 GF(2^255-19) field element: 10 limbs, radix 2^25.5 (alternating 26 and 25 bits).
 

Functions

Fe fe_from_bytes (const uint8_t *b)
 Load 32 little-endian bytes into a 10-limb field element.
 
void fe_carry_10 (Fe &h)
 
Fe fe_add (Fe a, const Fe &b)
 
Fe fe_sub (Fe a, const Fe &b)
 
Fe fe_mul (const Fe &f, const Fe &g)
 
Fe fe_sq (const Fe &a)
 
void fe_to_bytes (uint8_t *out, Fe h)
 
void fe_cswap (Fe &a, Fe &b, uint64_t swap)
 
Fe fe_inv (const Fe &z)
 
std::array< uint8_t, 32 > clamp_scalar (std::array< uint8_t, 32 > k)
 Clamp a 32-byte scalar per RFC 7748 §5.
 
std::array< uint8_t, 32 > x25519_raw (const std::array< uint8_t, 32 > &scalar, const std::array< uint8_t, 32 > &point_u)
 X25519 scalar multiplication: result = scalar * point.
 
expected< std::array< uint8_t, 32 > > x25519 (const std::array< uint8_t, 32 > &scalar, const std::array< uint8_t, 32 > &u_coord)
 Compute X25519(scalar, u_coord).
 
const std::array< uint8_t, 32 > & base_point ()
 The X25519 base point u=9, encoded as 32 LE bytes.
 
expected< std::pair< std::array< uint8_t, 32 >, std::array< uint8_t, 32 > > > generate_keypair ()
 Generate a new X25519 keypair.
 

Typedef Documentation

◆ Fe

using signet::forge::crypto::detail::x25519::Fe = typedef std::array<int32_t, 10>

GF(2^255-19) field element: 10 limbs, radix 2^25.5 (alternating 26 and 25 bits).

Definition at line 335 of file post_quantum.hpp.

Function Documentation

◆ base_point()

const std::array< uint8_t, 32 > & signet::forge::crypto::detail::x25519::base_point ( )
inline

The X25519 base point u=9, encoded as 32 LE bytes.

Definition at line 610 of file post_quantum.hpp.

◆ clamp_scalar()

std::array< uint8_t, 32 > signet::forge::crypto::detail::x25519::clamp_scalar ( std::array< uint8_t, 32 >  k)
inline

Clamp a 32-byte scalar per RFC 7748 §5.

Clear bits 0,1,2 of byte 0; clear bit 7 of byte 31; set bit 6 of byte 31.

Definition at line 491 of file post_quantum.hpp.

◆ fe_add()

Fe signet::forge::crypto::detail::x25519::fe_add ( Fe  a,
const Fe b 
)
inline

Definition at line 366 of file post_quantum.hpp.

◆ fe_carry_10()

void signet::forge::crypto::detail::x25519::fe_carry_10 ( Fe h)
inline

Definition at line 356 of file post_quantum.hpp.

◆ fe_cswap()

void signet::forge::crypto::detail::x25519::fe_cswap ( Fe a,
Fe b,
uint64_t  swap 
)
inline

Definition at line 454 of file post_quantum.hpp.

◆ fe_from_bytes()

Fe signet::forge::crypto::detail::x25519::fe_from_bytes ( const uint8_t *  b)
inline

Load 32 little-endian bytes into a 10-limb field element.

Definition at line 338 of file post_quantum.hpp.

◆ fe_inv()

Fe signet::forge::crypto::detail::x25519::fe_inv ( const Fe z)
inline

Definition at line 462 of file post_quantum.hpp.

◆ fe_mul()

Fe signet::forge::crypto::detail::x25519::fe_mul ( const Fe f,
const Fe g 
)
inline

Definition at line 393 of file post_quantum.hpp.

◆ fe_sq()

Fe signet::forge::crypto::detail::x25519::fe_sq ( const Fe a)
inline

Definition at line 418 of file post_quantum.hpp.

◆ fe_sub()

Fe signet::forge::crypto::detail::x25519::fe_sub ( Fe  a,
const Fe b 
)
inline

Definition at line 371 of file post_quantum.hpp.

◆ fe_to_bytes()

void signet::forge::crypto::detail::x25519::fe_to_bytes ( uint8_t *  out,
Fe  h 
)
inline

Definition at line 420 of file post_quantum.hpp.

◆ generate_keypair()

expected< std::pair< std::array< uint8_t, 32 >, std::array< uint8_t, 32 > > > signet::forge::crypto::detail::x25519::generate_keypair ( )
inline

Generate a new X25519 keypair.

secret_key: 32 random clamped bytes. public_key: X25519(secret_key, base_point).

Definition at line 622 of file post_quantum.hpp.

◆ x25519()

expected< std::array< uint8_t, 32 > > signet::forge::crypto::detail::x25519::x25519 ( const std::array< uint8_t, 32 > &  scalar,
const std::array< uint8_t, 32 > &  u_coord 
)
inline

Compute X25519(scalar, u_coord).

scalar is clamped per RFC 7748. Returns expected<array<uint8_t,32>>. Returns error if result is the all-zero output (low-order point / invalid input).

Definition at line 583 of file post_quantum.hpp.

◆ x25519_raw()

std::array< uint8_t, 32 > signet::forge::crypto::detail::x25519::x25519_raw ( const std::array< uint8_t, 32 > &  scalar,
const std::array< uint8_t, 32 > &  point_u 
)
inline

X25519 scalar multiplication: result = scalar * point.

Returns 32-byte output (little-endian u-coordinate of result point). Returns all-zero if result is the low-order point (invalid input).

Definition at line 501 of file post_quantum.hpp.