~ubuntu-branches/ubuntu/precise/ocaml-batteries/precise

« back to all changes in this revision

Viewing changes to src/core/extlib/extDigest.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2010-03-06 16:03:38 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100306160338-spvwiv3uc4jr28hw
Tags: 1.1.0-1
* New upstream release
  - major changes, "diet" version of the library
  - fix old FTBFS error, due to major code changes (Closes: #569455)
* Revamp packaging
  - adapt to new stuff shipped by upstream
  - switch from CDBS to dh
  - adapt dependencies (generally: reduce them)
* debian/patches/
  - remove old debian/patches/{debian-specific-installation-paths,
    debian-specific-info-on-doc-availability} as obsolete
  - new patch 0001-install-fix-for-bytecode-only-build: avoid
    installing *.a files with bytecode only compilation
* debian/libbatteries-ocaml-dev.links: remove file, shortend
  /usr/bin/ocaml-batteries to the top-level no longer exists
* remove debian/README.Debian (previous content is now obsolete)
* bump Standards-Version to 3.8.4 (no changes needed)
* debian/watch: update to match new upstream version convention
* debian/libbatteries-ocaml-{dev,doc}.{docs,examples}: ship only doc
  file from the root dir, other stuff is currently out of date
  (Closes: #514265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(*
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
5
 
 * 
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.
11
 
 *
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.
16
 
 *
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
20
 
 *)
21
 
 
22
 
 
23
 
(** MD5 message digest.
24
 
 
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.
29
 
 
30
 
    @documents MD5
31
 
    @author Xavier Leroy (Base module)
32
 
    @author David Rajchenbach-Teller
33
 
*)
34
 
module Digest : sig
35
 
open IO
36
 
 
37
 
type t = string
38
 
(** The type of digests: 16-character strings. *)
39
 
 
40
 
val string : string -> t
41
 
(** Return the digest of the given string. *)
42
 
 
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]
46
 
   characters. *)
47
 
 
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
54
 
   their digest. 
55
 
 
56
 
    {b Note} This version of [channel] is currently very inefficient
57
 
    if [len] < 0 and requires copying the whole input to a temporary
58
 
    file.
59
 
*)
60
 
 
61
 
 
62
 
val file : string -> t
63
 
(** Return the digest of the file whose name is given. *)
64
 
 
65
 
val output : 'a output -> t -> unit
66
 
(** Write a digest on the given output. *)
67
 
 
68
 
val input : input -> t
69
 
(** Read a digest from the given input. *)
70
 
 
71
 
val to_hex : t -> string
72
 
(** Return the printable hexadecimal representation of the given digest. *)
73
 
 
74
 
(** {6 Boilerplate code}*)
75
 
(** {7 S-Expressions}*)
76
 
 
77
 
val t_of_sexp : Sexplib.Sexp.t -> t
78
 
val sexp_of_t : t -> Sexplib.Sexp.t
79
 
end