Module Hacl.Curve25519_64

Hybrid C/assembly implementation: the field arithmetic functions are in Intel assembly (generated by Vale) and rely on the Intel ADX and BMI2 instruction sets; the elliptic curve functions and the main API are in portable C

type bytes = SharedDefs.CBytes.t
val secret_to_public : sk:bytes -> bytes

secret_to_public sk takes a 32-byte secret key sk and returns the corresponding 32-byte ECDH public key.

val ecdh : sk:bytes -> pk:bytes -> bytes option

ecdh sk pk takes a 32-byte secret key sk and another party's 32-byte public key and returns the 32-byte ECDH shared key.

val scalarmult : scalar:bytes -> point:bytes -> bytes

scalarmult scalar point performs scalar multiplication over the curve. Buffers are 32-byte long and must be distinct.

module Noalloc : sig ... end

Versions of these functions which write their output in a buffer passed in as an argument