secp256k1-internal

Bindings to secp256k1 internal functions (generic operations on the curve)
IN THIS PACKAGE
type t

Type of a group element (affine coordinates).

type ge = t
module Storage : sig ... end
module Jacobian : sig ... end
val of_fields : ?x:Field.t -> ?y:Field.t -> ?infinity:bool -> unit -> t
val g : t
val set_xy : t -> Field.t -> Field.t -> unit

Set a group element equal to the point with given X and Y coordinates

val set_xquad : t -> Field.t -> unit

Set a group element (affine) equal to the point with the given X coordinate and a Y coordinate that is a quadratic residue modulo p. The return value is true iff a coordinate with the given X coordinate exists.

val set_xovar : t -> Field.t -> int -> bool

Set a group element (affine) equal to the point with the given X coordinate, and given oddness for Y. Return value indicates whether the result is valid.

val is_infinity : t -> bool

Check whether a group element is the point at infinity.

val is_valid_var : t -> bool

Check whether a group element is valid (i.e., on the curve).

val neg : t -> t -> unit

neg r a Set r equal to the inverse of a (i.e., mirrored around the X axis)

val clear : t -> unit

Clear a t to prevent leaking sensitive information.

val to_storage : Storage.t -> t -> unit

Convert a group element to the storage type.

val from_storage : t -> Storage.t -> unit

Convert a group element back from the storage type.

val to_pubkey : ?compress:bool -> Cstruct.t -> t -> Cstruct.t

to_pubkey ?compress buf ge serializes ge in buf and returns buf, adjusted to the actual size.

val from_pubkey : t -> Cstruct.t -> unit

from_pubkey ge buf parses a serialized pubkey in buf and writes the result in ge.