Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / stdlib / digest.mli
blob981bd02fc3e8918e36cada6c5fb02481f8b864ca
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the GNU Library General Public License, with *)
10 (* the special exception on linking described in file ../LICENSE. *)
11 (* *)
12 (***********************************************************************)
14 (* $Id$ *)
16 (** MD5 message digest.
18 This module provides functions to compute 128-bit ``digests'' of
19 arbitrary-length strings or files. The digests are of cryptographic
20 quality: it is very hard, given a digest, to forge a string having
21 that digest. The algorithm used is MD5.
24 type t = string
25 (** The type of digests: 16-character strings. *)
27 val string : string -> t
28 (** Return the digest of the given string. *)
30 val substring : string -> int -> int -> t
31 (** [Digest.substring s ofs len] returns the digest of the substring
32 of [s] starting at character number [ofs] and containing [len]
33 characters. *)
35 external channel : in_channel -> int -> t = "caml_md5_chan"
36 (** If [len] is nonnegative, [Digest.channel ic len] reads [len]
37 characters from channel [ic] and returns their digest, or raises
38 [End_of_file] if end-of-file is reached before [len] characters
39 are read. If [len] is negative, [Digest.channel ic len] reads
40 all characters from [ic] until end-of-file is reached and return
41 their digest. *)
43 val file : string -> t
44 (** Return the digest of the file whose name is given. *)
46 val output : out_channel -> t -> unit
47 (** Write a digest on the given output channel. *)
49 val input : in_channel -> t
50 (** Read a digest from the given input channel. *)
52 val to_hex : t -> string
53 (** Return the printable hexadecimal representation of the given digest. *)