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