digestif

Hashes implementations (SHA*, RIPEMD160, BLAKE2* and MD5)
Library digestif_c
Module Digestif
type 'a iter = ( 'a -> unit ) -> unit

A general (inner) iterator. It applies the provided function to a collection of elements. For instance:

  • let iter_k : 'a -> 'a iter = fun x f -> f x
  • let iter_pair : 'a * 'a -> 'a iter = fun (x, y) -> f x; f y
  • let iter_list : 'a list -> 'a iter = fun l f -> List.iter f l
type 'a compare = 'a -> 'a -> int
type 'a equal = 'a -> 'a -> bool
type 'a pp = Format.formatter -> 'a -> unit
module type S = sig ... end
module type MAC = sig ... end

Some hash algorithms expose extra MAC constructs. The interface is similar to the hmac_* functions in S.

type kind = [
| `MD5
| `SHA1
| `RMD160
| `SHA224
| `SHA256
| `SHA384
| `SHA512
| `SHA3_224
| `SHA3_256
| `SHA3_384
| `SHA3_512
| `WHIRLPOOL
| `BLAKE2B
| `BLAKE2S
]
type 'k hash =
| MD5 : [ `MD5 ] hash
| SHA1 : [ `SHA1 ] hash
| RMD160 : [ `RMD160 ] hash
| SHA224 : [ `SHA224 ] hash
| SHA256 : [ `SHA256 ] hash
| SHA384 : [ `SHA384 ] hash
| SHA512 : [ `SHA512 ] hash
| SHA3_224 : [ `SHA3_224 ] hash
| SHA3_256 : [ `SHA3_256 ] hash
| SHA3_384 : [ `SHA3_384 ] hash
| SHA3_512 : [ `SHA3_512 ] hash
| WHIRLPOOL : [ `WHIRLPOOL ] hash
| BLAKE2B : int -> [ `BLAKE2B ] hash
| BLAKE2S : int -> [ `BLAKE2S ] hash
module MD5 : S with type kind = [ `MD5 ]
module SHA1 : S with type kind = [ `SHA1 ]
module SHA224 : S with type kind = [ `SHA224 ]
module SHA256 : S with type kind = [ `SHA256 ]
module SHA384 : S with type kind = [ `SHA384 ]
module SHA512 : S with type kind = [ `SHA512 ]
module SHA3_224 : S with type kind = [ `SHA3_224 ]
module SHA3_256 : S with type kind = [ `SHA3_256 ]
module SHA3_384 : S with type kind = [ `SHA3_384 ]
module SHA3_512 : S with type kind = [ `SHA3_512 ]
module WHIRLPOOL : S with type kind = [ `WHIRLPOOL ]
module BLAKE2B : sig ... end
module BLAKE2S : sig ... end
module RMD160 : S with type kind = [ `RMD160 ]
module Make_BLAKE2B (D : sig ... end) : S with type kind = [ `BLAKE2B ]
module Make_BLAKE2S (D : sig ... end) : S with type kind = [ `BLAKE2S ]
val md5 : [ `MD5 ] hash
val sha1 : [ `SHA1 ] hash
val rmd160 : [ `RMD160 ] hash
val sha224 : [ `SHA224 ] hash
val sha256 : [ `SHA256 ] hash
val sha384 : [ `SHA384 ] hash
val sha512 : [ `SHA512 ] hash
val sha3_224 : [ `SHA3_224 ] hash
val sha3_256 : [ `SHA3_256 ] hash
val sha3_384 : [ `SHA3_384 ] hash
val sha3_512 : [ `SHA3_512 ] hash
val whirlpool : [ `WHIRLPOOL ] hash
val blake2b : int -> [ `BLAKE2B ] hash
val blake2s : int -> [ `BLAKE2S ] hash
type 'kind t
val module_of : 'k hash -> (module S with type kind = 'k)
val digest_bytes : 'k hash -> Bytes.t -> 'k t
val digest_string : 'k hash -> String.t -> 'k t
val digest_bigstring : 'k hash -> bigstring -> 'k t
val digesti_bytes : 'k hash -> Bytes.t iter -> 'k t
val digesti_string : 'k hash -> String.t iter -> 'k t
val digesti_bigstring : 'k hash -> bigstring iter -> 'k t
val hmaci_bytes : 'k hash -> key:Bytes.t -> Bytes.t iter -> 'k t
val hmaci_string : 'k hash -> key:String.t -> String.t iter -> 'k t
val hmaci_bigstring : 'k hash -> key:bigstring -> bigstring iter -> 'k t
val pp : 'k hash -> 'k t pp
val equal : 'k hash -> 'k t equal
val unsafe_compare : 'k hash -> 'k t compare
val to_hex : 'k hash -> 'k t -> string
val of_hex : 'k hash -> string -> 'k t
val of_hex_opt : 'k hash -> string -> 'k t option
val consistent_of_hex : 'k hash -> string -> 'k t
val consistent_of_hex_opt : 'k hash -> string -> 'k t option
val of_raw_string : 'k hash -> string -> 'k t
val of_raw_string_opt : 'k hash -> string -> 'k t option
val to_raw_string : 'k hash -> 'k t -> string
val of_digest : (module S with type kind = 'k and type t = 'hash) -> 'hash -> 'k t
val of_md5 : MD5.t -> [ `MD5 ] t
val of_sha1 : SHA1.t -> [ `SHA1 ] t
val of_rmd160 : RMD160.t -> [ `RMD160 ] t
val of_sha224 : SHA224.t -> [ `SHA224 ] t
val of_sha256 : SHA256.t -> [ `SHA256 ] t
val of_sha384 : SHA384.t -> [ `SHA384 ] t
val of_sha512 : SHA512.t -> [ `SHA512 ] t
val of_sha3_224 : SHA3_224.t -> [ `SHA3_224 ] t
val of_sha3_256 : SHA3_256.t -> [ `SHA3_256 ] t
val of_sha3_384 : SHA3_384.t -> [ `SHA3_384 ] t
val of_sha3_512 : SHA3_512.t -> [ `SHA3_512 ] t
val of_whirlpool : WHIRLPOOL.t -> [ `WHIRLPOOL ] t
val of_blake2b : BLAKE2B.t -> [ `BLAKE2B ] t
val of_blake2s : BLAKE2S.t -> [ `BLAKE2S ] t