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

« back to all changes in this revision

Viewing changes to src/batDigest.ml

  • 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 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
open BatIO
 
23
 
 
24
(*Imported from [Digest.input] -- the functions used take advantage of
 
25
  [BatIO.input] rather than [in_channel]*)
 
26
let input inp = 
 
27
  let digest = String.create 16 in
 
28
  let _      = really_input inp digest 0 16 in
 
29
    digest
 
30
 
 
31
 
 
32
let output = BatIO.nwrite
 
33
 
 
34
 
 
35
let channel inp len = (*TODO: Make efficient*)
 
36
  if len >= 0 then 
 
37
    let buf = String.create len             in
 
38
    let _   = BatIO.really_input inp buf 0 len in
 
39
      Digest.string buf
 
40
  else Digest.channel (BatIO.to_input_channel inp) len