summaryrefslogtreecommitdiff
path: root/src/cryptokit.mli
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptokit.mli')
-rw-r--r--src/cryptokit.mli58
1 files changed, 48 insertions, 10 deletions
diff --git a/src/cryptokit.mli b/src/cryptokit.mli
index 3cb58ed..0392eca 100644
--- a/src/cryptokit.mli
+++ b/src/cryptokit.mli
@@ -11,8 +11,6 @@
(* *)
(***********************************************************************)
-(* $Id$ *)
-
(** The Cryptokit library provides a variety of cryptographic primitives
that can be used to implement cryptographic protocols in
security-sensitive applications. The primitives provided include:
@@ -23,11 +21,6 @@
and MACs based on AES and DES.
- Random number generation.
- Encodings and compression: base 64, hexadecimal, Zlib compression.
-
- To use this library, link with
- [ocamlc unix.cma nums.cma cryptokit.cma]
- or
- [ocamlopt unix.cmxa nums.cmxa cryptokit.cmxa].
*)
(** {1 General-purpose abstract interfaces} *)
@@ -603,6 +596,22 @@ module Hash : sig
val sha512: unit -> hash
(** SHA-512 is SHA-2 specialized to 512 bit hashes (64 bytes). *)
+ val 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. *)
+
+ val blake2b512: unit -> hash
+ (** BLAKE2b512 is BLAKE2b specialized to 512 bit hashes (64 bytes). *)
+
+ val 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. *)
+
+ val blake2s256: unit -> hash
+ (** BLAKE2s256 is BLAKE2s specialized to 256 bit hashes (32 bytes). *)
+
val ripemd160: unit -> hash
(** RIPEMD-160 produces 160-bit hashes (20 bytes). *)
@@ -631,9 +640,10 @@ end
and if it matches the transmitted MAC, be reasonably certain that
the text was authentified by someone who possesses the secret key.
- The module [MAC] provides five MAC functions based on the hashes
- SHA-1, SHA256, SHA512, RIPEMD160 and MD5, and five MAC functions based on
- the block ciphers AES, DES, and Triple-DES. *)
+ The module [MAC] provides six MAC functions based on the hashes
+ BLAKE2b, SHA-1, SHA256, SHA512, RIPEMD160 and MD5,
+ and five MAC functions based on the block ciphers AES, DES, and Triple-DES.
+*)
module MAC: sig
val hmac_sha1: string -> hash
@@ -669,6 +679,34 @@ module MAC: sig
long. The [key] argument is the MAC key; it can have any length,
but a minimal length of 16 bytes is recommended. *)
+ val blake2b: int -> string -> hash
+ (** [blake2b sz key] is the BLAKE2b keyed hash function.
+ The returned hash values have length 1 to 64 bytes.
+ The [sz] is the desired size of the hash, in bits.
+ It must be between 8 and 512, and a multiple of 8.
+ The [key] argument is the MAC key. It must have length 64 at most.
+ A length of 64 bytes is recommended. *)
+
+ val blake2b512: string -> hash
+ (** [blake2b512 key] is the BLAKE2b keyed hash function specialized
+ to 512 byte hashes (64 bytes).
+ The [key] argument is the MAC key. It must have length 64 at most.
+ A length of 64 bytes is recommended. *)
+
+ val blake2s: int -> string -> hash
+ (** [blake2s sz key] is the BLAKE2s keyed hash function.
+ The returned hash values have length 1 to 32 bytes.
+ The [sz] is the desired size of the hash, in bits.
+ It must be between 8 and 256, and a multiple of 8.
+ The [key] argument is the MAC key. It must have length 32 at most.
+ A length of 32 bytes is recommended. *)
+
+ val blake2s256: string -> hash
+ (** [blake2s256 key] is the BLAKE2s keyed hash function specialized
+ to 256 byte hashes (32 bytes).
+ The [key] argument is the MAC key. It must have length 32 at most.
+ A length of 32 bytes is recommended. *)
+
val aes_cmac: ?iv:string -> string -> hash
(** [aes_cmac key] returns a MAC based on AES encryption in CMAC mode,
also known as OMAC1 mode. The input data is encrypted using