package cryptokit

  1. Overview
  2. Docs

Module Cryptokit.P521Source

NIST elliptic curve P-521

Parameters of the curve

Sourcetype point

The type of points on the curve.

Sourceval x : point -> Z.t

X coordinate of a point.

Sourceval y : point -> Z.t

Y coordinate of a point.

Sourceval zero : point

The point at infinity. It is the neutral element of the group.

Sourceval generator : point

The generator for the group.

Sourceval make_point : (Z.t * Z.t) -> point

Construct a point with the given (x, y) coordinates.

Sourceval encode_point : ?compressed:bool -> point -> string

Encode a point as a string according to P1363-2000. If compressed is false, the encoding contains the x and y coordinates. If compressed is true, the encoding only contains the x coordinate and the sign of y.

Sourceval decode_point : string -> point

Decode a P1363-2000 encoding (as produced by encode_point) into a point of the curve.

Sourceval add : point -> point -> point

Sum of two points. This is the group operation.

Sourceval neg : point -> point

Opposite of a point. This is the group inverse.

Sourceval dbl : point -> point

Doubling of a point: dbl x = add x x, but a bit faster.

Sourceval mul : Z.t -> point -> point

Multiplication of a point by a scalar. mul n p is p added to itself n times. n must be non-negative.

Sourceval muladd : Z.t -> point -> Z.t -> point -> point

Multiplication of two points by two scalars, and addition. mul n p m q is add (mul n p) (mul m q). n and m must be non-negative.