package rfc7748

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This library provides the two Diffie-Hellman-like functions defined in the eponymous RFC, x25519 and x448.

Summary

X25519 and X448 are instances of a special subset of elliptic curves, the so-called Edwards curves, for which point addition has a closed form. This eliminates a whole class of problems that arise in other elliptic curve implementations, where addition formulas depend on the arguments (e.g. whether a point is added to itself). In addition, these curves are also designed to be safe to implement and use: the addition formula is by construction resistant to timing attacks, neither public keys nor private keys need to be validated and the string-based interface is very portable.

Quick Start

You can use Rfc7748.x25519 and Rfc7748.x448 as described in the example program in the source tree.

API

Below is the public API for this library. It is divided into

module type DH = sig ... end

Signature of the modules implementing the Diffie-Hellman functions for RFC 7748.

module X25519 : DH

X25519 (based on Curve25519 by Daniel J. Bernstein)

module X448 : DH

X448 (based on Ed448-Goldilocks by Mike Hamburg)

val x25519 : priv:string -> pub:string -> string

This is a shortcut for using X25519.scale without converting keys.

val x448 : priv:string -> pub:string -> string

This is a shortcut for using X448.scale without converting keys.