secp256k1-internal

Bindings to secp256k1 internal functions (generic operations on the curve)
IN THIS PACKAGE
type t
val zero : unit -> t
val one : unit -> t
val of_uint16 : int -> t
val of_uint32 : int32 -> t
val of_uint64 : int64 -> t
val copy : t -> t -> unit

Copy a number.

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

Convert a number's absolute value to a binary big-endian string. There must be enough place.

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

Set a number to the value of a binary big-endian string.

val mod_inverse : t -> t -> t -> unit

mod_inverse r a m Compute a modular inverse. The input must be less than the modulus.

val jacobi : t -> t -> int

Compute the jacobi symbol (a|b). b must be positive and odd.

val compare : t -> t -> int

Compare the absolute value of two numbers.

val equal : t -> t -> bool

Test whether two number are equal (including sign).

val add : t -> t -> t -> unit

add r a b Add two (signed) numbers.

val sub : t -> t -> t -> unit

sub r a b Subtract two (signed) numbers.

val mul : t -> t -> t -> unit

mul r a b Multiply two (signed) numbers.

val modulo : t -> t -> unit

Replace a number by its remainder modulo m. M's sign is ignored. The result is a number between 0 and m-1, even if r was negative.

val shift : t -> int -> unit

shift t bits Right-shift the passed number by bits bits.

val is_zero : t -> bool

Check whether a number is zero.

val is_one : t -> bool

Check whether a number is one.

val is_neg : t -> bool

Check whether a number is strictly negative.

val negate : t -> unit

Change a number's sign.