Module K256.Noalloc

Versions of these functions which write their output in a buffer passed in as an argument

Point representation and conversions

val raw_to_compressed : p:bytes -> result:bytes -> unit

raw_to_compressed p result converts a "raw" point p (64 bytes) to a "compressed" point result (33 bytes).

val raw_to_uncompressed : p:bytes -> result:bytes -> unit

raw_to_uncompressed p result converts a "raw" point p (64 bytes) to an "uncompressed" point result (65 bytes).

val compressed_to_raw : p:bytes -> result:bytes -> bool

compressed_to_raw p result converts a "compressed" point p (33 bytes) to a "raw" point result (64 bytes). Returns true if successful.

val uncompressed_to_raw : p:bytes -> result:bytes -> bool

uncompressed_to_raw p result converts an "uncompressed" point p (65 bytes) to a "raw" point result (64 bytes). Returns true if successful.

ECDSA

val secret_to_public : sk:bytes -> pk:bytes -> bool

secret_to_public sk pk checks if sk is a valid secret key and, if it is, writes the corresponding public key in pk and returns true.

val sign : sk:bytes -> msg:bytes -> k:bytes -> signature:bytes -> bool

sign sk msg k signature attempts to sign the message msg with secret key sk and signing secret k. If successful, the signature is written in signature and the function returns true.

module Libsecp256k1 : sig ... end

Versions of the ECDSA functions which work on low-S normalized signatures. These functions can be used when compatibility with libsecp256k1 is required.