package secp256k1-internal

  1. Overview
  2. Docs

Module Internal.NumSource

Sourcetype t
Sourceval zero : unit -> t
Sourceval one : unit -> t
Sourceval of_uint16 : int -> t
Sourceval of_uint32 : int32 -> t
Sourceval of_uint64 : int64 -> t
Sourceval copy : t -> t -> unit

Copy a number.

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

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

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

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

Sourceval mod_inverse : t -> t -> t -> unit

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

Sourceval jacobi : t -> t -> int

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

Sourceval compare : t -> t -> int

Compare the absolute value of two numbers.

Sourceval equal : t -> t -> bool

Test whether two number are equal (including sign).

Sourceval add : t -> t -> t -> unit

add r a b Add two (signed) numbers.

Sourceval sub : t -> t -> t -> unit

sub r a b Subtract two (signed) numbers.

Sourceval mul : t -> t -> t -> unit

mul r a b Multiply two (signed) numbers.

Sourceval 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.

Sourceval shift : t -> int -> unit

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

Sourceval is_zero : t -> bool

Check whether a number is zero.

Sourceval is_one : t -> bool

Check whether a number is one.

Sourceval is_neg : t -> bool

Check whether a number is strictly negative.

Sourceval negate : t -> unit

Change a number's sign.