tezos-crypto

Tezos: library with all the cryptographic primitives used by Tezos
IN THIS PACKAGE
Module type Tezos_crypto . Hacl . SIGNATURE
type _ key
val size : int

Size of a signature

val pk_size : int

Size of a public key

val sk_size : int

Size of a secret key

val compare : 'a key -> 'a key -> int
val equal : 'a key -> 'a key -> bool
val sk_of_bytes : Bytes.t -> secret key option
val pk_of_bytes : Bytes.t -> public key option
val pk_of_bytes_without_validation : Bytes.t -> public key option

This function does not check that the resulting pk is valid. It is slightly faster than pk_of_bytes but should only be used to deserialize bytes that were serialized from a pk. E.g. the pks in the storage of the protocol.

val neuterize : 'a key -> public key

neuterize sk generates the corresponding public key of sk

val keypair : unit -> public key * secret key

keypair generates both a secret key and its corresponding public key

val to_bytes : _ key -> Bytes.t

to_bytes key returns the contents of the key. For P-256 public keys, it returns the compressed form (see hacl.ml for more details)

val blit_to_bytes : _ key -> ?pos:int -> Bytes.t -> unit

blit_to_bytes key ?pos buf copies all of the bytes of key into buf starting at position pos. As above, P-256 public keys are written in compressed form.

val sign : sk:secret key -> msg:Bytes.t -> Bytes.t

sign sk msg returns the signature of msg with sk

val verify : pk:public key -> msg:Bytes.t -> signature:Bytes.t -> bool

verify pk msg signature attempts to verify msg with signature and returns true if successful