Nimony

The road to Nim 3

x25519

nimony/lib/std/crypto/x25519.nim

X25519 Diffie-Hellman (RFC 7748).

The field is GF(2^255 - 19) in sixteen 16-bit limbs held in int64s, after TweetNaCl: every product fits, carries are arithmetic shifts, and the Montgomery ladder swaps with a mask. Nothing branches on or indexes by a secret, so the scalar does not leak through timing.