![]()
|
Module Cryptokitmodule Cryptokit:
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:
ocamlc unix.cma nums.cma cryptokit.cma
or
ocamlopt unix.cmxa nums.cmxa cryptokit.cmxa.
class type transform =
A transform is an arbitrary mapping from sequences of characters
to sequences of characters.
val transform_string : transform_string t s runs the string s through the
transform t and returns the transformed string.
The transform t is wiped before returning, hence can
no longer be used for further transformations.val transform_channel : transform_channel t ic oc reads characters from input channel ic,
runs them through the transform t, and writes the transformed
data to the output channel oc. If the optional len argument
is provided, exactly len characters are read from ic and
transformed; End_of_file is raised if ic does not contain
at least len characters. If len is not provided, ic is
read all the way to end of file.
The transform t is wiped before returning, hence can
no longer be used for further transformations.val compose :
Compose two transforms, feeding the output of the first transform
to the input of the second transform.
class type hash =
A hash is a function that maps arbitrarily-long character
sequences to small, fixed-size strings.
val hash_string : hash_string h s runs the string s through the hash function h
and returns the hash value of s.
The hash h is wiped before returning, hence can
no longer be used for further hash computations.val hash_channel : hash_channel h ic reads characters from the input channel ic,
computes their hash value and returns it.
If the optional len argument is provided, exactly len characters
are read from ic and hashed; End_of_file is raised if ic
does not contain at least len characters.
If len is not provided, ic is read all the way to end of file.
The hash h is wiped before returning, hence can
no longer be used for further hash computations.
module Random:
The
Random module provides random and pseudo-random number generators
suitable for generating cryptographic keys, nonces, or challenges.
module Padding:
The
Padding module defines a generic interface
for padding input data to an integral number of blocks,
as well as two popular padding schemes.
module Cipher:
The
Cipher module implements the AES, DES, Triple-DES and ARCfour
symmetric ciphers.
module Hash:
The
Hash module implements unkeyed cryptographic hashes SHA-1
and MD5, also known as message digest functions.
module MAC:
The
MAC module implements message authentication codes, also
known as keyed hash functions.
module RSA:
The
RSA module implements RSA public-key cryptography.
module DH:
The
DH module implements Diffie-Hellman key agreement.
module Block:
The
Block module provides classes that implements
popular block ciphers, chaining modes, and wrapping of a block cipher
as a general transform or as a hash function.
module Stream:
The
Stream module provides classes that implement
the ARCfour stream cipher, and the wrapping of a stream cipher
as a general transform.
module Base64:
The
Base64 module supports the encoding and decoding of
binary data in base 64 format, using only alphanumeric
characters that can safely be transmitted over e-mail or
in URLs.
module Hexa:
The
Hexa module supports the encoding and decoding of
binary data as hexadecimal strings.
module Zlib:
The
Zlib module supports the compression and decompression
of data, using the zlib library.
type error =
Error codes for this library.
exception Error of
Exception raised by functions in this library
to report error conditions.
val wipe_string : wipe_string s overwrites s with zeroes. Can be used
to reduce the memory lifetime of sensitive data.val xor_string : xor_string src spos dst dpos len performs the xor (exclusive or)
of characters spos, ..., spos + len - 1 of src
with characters dpos, ..., dpos + len - 1 of dst,
storing the result in dst starting at position dpos.val mod_power : mod_power a b c computes a^b mod c, where the
strings a, b, c and the result string are viewed as
arbitrary-precision integers in big-endian format.
Requires a < c.val mod_mult : mod_mult a b c computes a*b mod c, where the
strings a, b, c and the result string are viewed as
arbitrary-precision integers in big-endian format. |