2
* ExtDigest - Additional functions for MD5 message digests
3
* Copyright (C) 1996 Xavier Leroy, INRIA Rocquencourt
4
* Copyright (C) 2009 David Teller, LIFO, Universite d'Orleans
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version,
10
* with the special exception on linking described in file LICENSE.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
(** MD5 message digest.
25
This module provides functions to compute 128-bit ``digests'' of
26
arbitrary-length strings or files. The digests are of cryptographic
27
quality: it is very hard, given a digest, to forge a string having
28
that digest. The algorithm used is MD5.
31
@author Xavier Leroy (Base module)
32
@author David Rajchenbach-Teller
38
(** The type of digests: 16-character strings. *)
40
val string : string -> t
41
(** Return the digest of the given string. *)
43
val substring : string -> int -> int -> t
44
(** [Digest.substring s ofs len] returns the digest of the substring
45
of [s] starting at character number [ofs] and containing [len]
48
val channel : input -> int -> t
49
(** If [len] is nonnegative, [Digest.channel ic len] reads [len]
50
characters from channel [ic] and returns their digest, or raises
51
[End_of_file] if end-of-file is reached before [len] characters
52
are read. If [len] is negative, [Digest.channel ic len] reads
53
all characters from [ic] until end-of-file is reached and return
56
{b Note} This version of [channel] is currently very inefficient
57
if [len] < 0 and requires copying the whole input to a temporary
62
val file : string -> t
63
(** Return the digest of the file whose name is given. *)
65
val output : 'a output -> t -> unit
66
(** Write a digest on the given output. *)
68
val input : input -> t
69
(** Read a digest from the given input. *)
71
val to_hex : t -> string
72
(** Return the printable hexadecimal representation of the given digest. *)
74
(** {6 Boilerplate code}*)
75
(** {7 S-Expressions}*)
77
val t_of_sexp : Sexplib.Sexp.t -> t
78
val sexp_of_t : t -> Sexplib.Sexp.t