cheatah
Module

x25519

Functions

fn std::string x25519(std::string_view scalar_hex, std::string_view point_hex) source#

The X25519 function: scalar-multiply point_hex (a u-coordinate) by scalar_hex.

For Diffie-Hellman: shared = x25519(my_secret, their_public).

Parameters
scalar_hex

64-char hex (32-byte scalar; clamped per RFC 7748).

point_hex

64-char hex (32-byte u-coordinate).

Returns

the 32-byte result as 64-char hex, or "" on malformed input or an all-zero result (a contributory-behaviour check: a zero shared secret is REJECTED).

Complexity

O(1) — 255 constant-time ladder steps.

Allocation

the returned string.

fn std::string x25519_base(std::string_view scalar_hex) source#

The base-point form: derive the public key for scalar_hex (u = 9).

Parameters
scalar_hex

64-char hex secret key.

Returns

the public key as 64-char hex, or "" on malformed input.

Complexity

O(1) — one ladder.

Allocation

the returned string.