Skip to content

X25519

Source: std/x25519.mw.

X25519 (RFC 7748) over GF(2^255-19), after TweetNaCl: field elements are 16 limbs of 16 bits held in i64, which needs no 128-bit arithmetic.

fn x25519(out: *u8, scalar: *u8, point: *u8)

out = scalar * point (all 32 bytes, little endian).

fn x25519_base(out: *u8, scalar: *u8)

Public key for a 32-byte secret (scalar * basepoint 9).