package cryptokit

  1. Overview
  2. Docs
A library of cryptographic primitives

Install

Dune Dependency

Authors

Maintainers

Sources

release1201.tar.gz
sha256=b933c32b4e03e7236add969c2f583df241aeff8eabd2cabb1f345a78250fcea6
sha512=7b1e2ba8b99b11a04522ffe4b6b92278bc772d9888967757ab013151211fc85d29847af566677f2b9c3200e45b857600a70356ca6ed80ca299508808057358b1

doc/cryptokit/Cryptokit/Hash/index.html

Module Cryptokit.HashSource

The Hash module implements unkeyed cryptographic hashes (SHA-1, SHA-256, SHA-512, SHA-3, RIPEMD-160 and MD5), also known as message digest functions. Hash functions used in cryptography are characterized as being one-way (given a hash value, it is computationally infeasible to find a text that hashes to this value) and collision-resistant (it is computationally infeasible to find two different texts that hash to the same value). Thus, the hash of a text can be used as a compact replacement for this text for the purposes of ensuring integrity of the text.

Sourceval sha3 : int -> hash

SHA-3, the latest NIST standard for cryptographic hashing, produces hashes of 224, 256, 384 or 512 bits (24, 32, 48 or 64 bytes). The parameter is the desired size of the hash, in bits. It must be one of 224, 256, 384 or 512.

Sourceval keccak : int -> hash

The Keccak submission for the SHA-3 is very similar to sha3 but uses a slightly different padding. The parameter is the same as that of sha3.

Sourceval sha2 : int -> hash

SHA-2, another NIST standard for cryptographic hashing, produces hashes of 224, 256, 384, or 512 bits (24, 32, 48 or 64 bytes). The parameter is the desired size of the hash, in bits. It must be one of 224, 256, 384 or 512.

Sourceval sha224 : unit -> hash

SHA-224 is SHA-2 specialized to 224 bit hashes (24 bytes).

Sourceval sha256 : unit -> hash

SHA-256 is SHA-2 specialized to 256 bit hashes (32 bytes).

Sourceval sha384 : unit -> hash

SHA-384 is SHA-2 specialized to 384 bit hashes (48 bytes).

Sourceval sha512 : unit -> hash

SHA-512 is SHA-2 specialized to 512 bit hashes (64 bytes).

Sourceval blake2b : int -> hash

The BLAKE2b hash function produces hashes of length 1 to 64 bytes. The parameter is the desired size of the hash, in bits. It must be between 8 and 512, and a multiple of 8.

Sourceval blake2b512 : unit -> hash

BLAKE2b512 is BLAKE2b specialized to 512 bit hashes (64 bytes).

Sourceval blake2s : int -> hash

The BLAKE2s hash function produces hashes of length 1 to 32 bytes. The parameter is the desired size of the hash, in bits. It must be between 8 and 256, and a multiple of 8.

Sourceval blake2s256 : unit -> hash

BLAKE2s256 is BLAKE2s specialized to 256 bit hashes (32 bytes).

Sourceval blake3 : int -> hash

The BLAKE3 hash function produces hashes of arbitrary length. The recommended length is 32 bytes (256 bits). Shorter hashes are less secure, but longer hashes are not more secure. The parameter is the desired size of the hash, in bits. It must be positive and a multiple of 8.

Sourceval blake3_256 : unit -> hash

The BLAKE3 hash function, specialized to 256 bit hashes (32 bytes).

Sourceval ripemd160 : unit -> hash

RIPEMD-160 produces 160-bit hashes (20 bytes).

Sourceval sha1 : unit -> hash

SHA-1 is the Secure Hash Algorithm revision 1. It is a NIST standard, is widely used, and produces 160-bit hashes (20 bytes). While popular in many legacy applications, it is now known to be insecure. In particular, it is not collision-resistant.

  • alert crypto SHA1 is broken
Sourceval md5 : unit -> hash

MD5 is an older hash function, producing 128-bit hashes (16 bytes). While popular in many legacy applications, it is now known to be insecure. In particular, it is not collision-resistant.

  • alert crypto MD5 is broken
OCaml

Innovation. Community. Security.