stdlib/x25519View source ↗
x25519
18 items · generated by scribe fromstdlib/x25519.fd· synced 2026-11-15
Contents
- Fe25519 (struct)
- f25_sq_n (function)
- f25_invert (function)
- f25_pow22523 (function)
- f25_from_bytes_at (function)
- f25_from_bytes (function)
- f25_to_bytes (function)
- f25_is_zero (function)
- f25_equal (function)
- f25_is_odd (function)
- x25519_scalarmult (function)
- x25519_public_key (function)
- x25519_is_all_zero (function)
- x25519_shared_secret (function)
Fe25519
A field element mod 2^255-19: value = sum a_i * 2^ceil(25.5 i).
pub struct Fe25519 {Fields:
| Name | Type |
|---|---|
a0 | i64 |
a1 | i64 |
a2 | i64 |
a3 | i64 |
a4 | i64 |
a5 | i64 |
a6 | i64 |
a7 | i64 |
a8 | i64 |
a9 | i64 |
Defined at line 40
f25_sq_n
f^(2^n), n >= 1.
pub fn f25_sq_n(f: Fe25519, n: i64) -> Fe25519 {Parameters:
f:Fe25519n:i64
Returns: Fe25519
Defined at line 253
f25_invert
z^(p-2) = 1/z (0 for z = 0): 254 squarings, 11 multiplications.
pub fn f25_invert(z: Fe25519) -> Fe25519 {Parameters:
z:Fe25519
Returns: Fe25519
Defined at line 272
f25_pow22523
z^((p-5)/8) = z^(2^252 - 3), for square roots (Ed25519 decoding).
pub fn f25_pow22523(z: Fe25519) -> Fe25519 {Parameters:
z:Fe25519
Returns: Fe25519
Defined at line 293
f25_from_bytes_at
The 32 bytes b[off..off+32] as a field element; bit 255 is ignored. A value in [p, 2^255) is accepted and works as that value mod p.
pub fn f25_from_bytes_at(b: & Vec<i64>, off: i64) -> Fe25519 {Parameters:
b:& Vec<i64>off:i64
Returns: Fe25519
Defined at line 325
f25_from_bytes
pub fn f25_from_bytes(b: Vec<i64>) -> Fe25519 {Parameters:
b:Vec<i64>
Returns: Fe25519
Defined at line 331
f25_to_bytes
The canonical 32-byte little-endian encoding (value in [0, p)).
pub fn f25_to_bytes(f: Fe25519) -> Vec<i64> {Parameters:
f:Fe25519
Returns: Vec<i64>
Defined at line 336
f25_is_zero
1 when f = 0 mod p, else 0.
pub fn f25_is_zero(f: Fe25519) -> i64 {Parameters:
f:Fe25519
Returns: i64
Defined at line 423
f25_equal
1 when f = g mod p, else 0.
pub fn f25_equal(f: Fe25519, g: Fe25519) -> i64 {Parameters:
f:Fe25519g:Fe25519
Returns: i64
Defined at line 435
f25_is_odd
The low bit of the canonical value (“negative” in RFC 8032).
pub fn f25_is_odd(f: Fe25519) -> i64 {Parameters:
f:Fe25519
Returns: i64
Defined at line 440
x25519_scalarmult
X25519(k, u) of RFC 7748 §5: the u-coordinate of [clamp(k)] u. Both arguments are 32 bytes; bit 255 of u is ignored and a non-canonical u (>= p) is reduced, as the RFC requires. Panics on a wrong length. Constant time in k (a fixed 255-step Montgomery ladder with masked swaps).
pub fn x25519_scalarmult(scalar: Vec<i64>, u: Vec<i64>) -> Vec<i64> {Parameters:
scalar:Vec<i64>u:Vec<i64>
Returns: Vec<i64>
Defined at line 507
x25519_public_key
The public key of a 32-byte secret key: X25519(k, 9).
pub fn x25519_public_key(secret: Vec<i64>) -> Vec<i64> {Parameters:
secret:Vec<i64>
Returns: Vec<i64>
Defined at line 523
x25519_is_all_zero
1 when all 32 bytes are zero (checked without an early exit).
pub fn x25519_is_all_zero(k: Vec<i64>) -> bool {Parameters:
k:Vec<i64>
Returns: bool
Defined at line 535
x25519_shared_secret
The Diffie-Hellman shared secret X25519(secret, peer_public) of RFC 7748 §6.1, or None when it is all zero (the peer sent a small-order point).
pub fn x25519_shared_secret(secret: Vec<i64>, peer_public: Vec<i64>) -> Option<Vec<i64>> {Parameters:
secret:Vec<i64>peer_public:Vec<i64>
Returns: Option<Vec<i64>>
Defined at line 547
Generated by scribe, the Fides documentation generator