Module Hash.Algorithm

Hash algorithm identifiers.

Algorithm identifiers

type t =
  1. | Aes_mmo_zigbee
  2. | Md2
    (*

    MD2 WARNING weak, only use for legacy applications.

    *)
  3. | Md4
    (*

    MD4 WARNING weak, only use for legacy applications.

    *)
  4. | Md5
    (*

    MD5 WARNING weak, only use for legacy applications.

    *)
  5. | Ripemd_160
  6. | Sha3_224
  7. | Sha3_256
  8. | Sha3_384
  9. | Sha3_512
  10. | Sha_1
    (*

    SHA-1 WARNING weak, only use for legacy applications.

    *)
  11. | Sha_224
  12. | Sha_256
  13. | Sha_384
  14. | Sha_512
  15. | Sha_512_224
  16. | Sha_512_256
  17. | Shake256_512
  18. | Sm3
    (*

    SM3

    *)

The type for hash algorithm identifiers.

Use is_supported to see which ones are supported by the current implementation.

val is_supported : t -> bool

is_supported a is true iff the current implementation supports the hash algorithm a.

val length : t -> int

length a is the length in bytes of hashes of algorithm a. Note that this can be 0 if the algorithm is unsupported.

Predicates and comparisons

val equal : t -> t -> bool

equal tests algorithm identifiers for equality.

val compare : t -> t -> int

compare is a total order compatible with equal.

Converting

val of_string : string -> (t, string) Stdlib.result

of_string s is an algorithm from s. Lowercased match of s against the identifiers specified in these comments.

val to_string : t -> string

to_string a is an ASCII string for a. Lowercased identifiers mentioned in these comments.

val pp : Stdlib.Format.formatter -> t -> unit

pp formats algorithms for inspection.