# Module Netsys_digests

    module Netsys_digests: sig .. end

Cryptographic digests (hashes)

    type iana_hash_fn = [ `MD2 | `MD5 | `SHA_1 | `SHA_224 | `SHA_256 | `SHA_384 | `SHA_512 ]

The hash functions contained in the IANA registry (http://www.iana.org/assignments/hash-function-text-names/hash-function-text-names.xhtml).

    class type digest_ctx = object .. end

    class type digest = object .. end

The following functions use the current digest module (as retrieved by `Netsys_crypto.current_digests`), unless the `impl` argument is passed.

    val digests : ?impl:(module Netsys_crypto_types.DIGESTS) ->
           unit -> digest list

List of supported digests

    val find : ?impl:(module Netsys_crypto_types.DIGESTS) -> string -> digest

`find name`: get the digest `name`.

The name conventionally follows the `<uppercasestring>-<size>` format, e.g. "MD5-128", "SHA1-160", or "SHA2-256".

    val digest_string : digest -> string -> string

Digest a string

    val digest_mstrings : digest -> Netsys_types.mstring list -> string

Digest a sequence of mstrings

    val hmac : digest -> string -> digest

`hmac dg key`: returns the digest context computing the HMAC construction (RFC-2104).

The key must not be longer than dg#block_length.

    val iana_find : ?impl:(module Netsys_crypto_types.DIGESTS) ->
           iana_hash_fn -> digest

`iana_find name`: get the digest `name`

    val iana_alist : (string * iana_hash_fn) list

maps the IANA name to the hash function id

    val iana_rev_alist : (iana_hash_fn * string) list

the reverse

    val oid_alist : (int array * iana_hash_fn) list

maps the OID to the hash function id

    val oid_rev_alist : (iana_hash_fn * int array) list

the reverse

    val name_alist : (string * iana_hash_fn) list

maps the OCamlnet name to the hash function id

    val name_rev_alist : (iana_hash_fn * string) list

the reverse