package secp256k1-internal
Library
Module
Module type
Parameter
Class
Class type
val zero : unit -> t
val one : unit -> t
val const :
?d7:int32 ->
?d6:int32 ->
?d5:int32 ->
?d4:int32 ->
?d3:int32 ->
?d2:int32 ->
?d1:int32 ->
?d0:int32 ->
unit ->
t
val clear : t -> unit
Clear a scalar to prevent the leak of sensitive data.
val get_bits : t -> int -> int -> int
get_bits a offset count
Access bits from a scalar. All requested bits must belong to the same 32-bit limb.
val get_bits_var : t -> int -> int -> int
get_bits a offset count
Access bits from a scalar. Not constant time.
val set_b32 : t -> Cstruct.t -> bool
Set a scalar from a big endian byte array.
val set_int : t -> int -> unit
Set a scalar to an unsigned integer.
val get_b32 : Cstruct.t -> t -> unit
Convert a scalar to a byte array.
add r a b
Add two scalars together (modulo the group order). Returns whether it overflowed.
val cadd_bit : t -> int -> bool -> unit
cadd_bit r bit flag
Conditionally add a power of two to a scalar. The result is not allowed to overflow.
val shr_int : t -> int -> int
Shift a scalar right by some amount strictly between 0 and 16, returning the low bits that were shifted off
inverse_var r a
Compute the inverse of a scalar (modulo the group order), without constant-time guarantee.
val is_zero : t -> bool
Check whether a scalar equals zero.
val is_one : t -> bool
Check whether a scalar equals one.
val is_even : t -> bool
Check whether a scalar, considered as an nonnegative integer, is even.
val is_high : t -> bool
Check whether a scalar is higher than the group order divided by 2.
val cond_negate : t -> bool -> bool
Conditionally negate a number, in constant time. Returns true
if the number was negated, false
otherwise