blob: 7fda97f584db812d00429c997b332db3d786ba13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
(* Implementation the SHA-1 hash function.
Written by Tom 7 in 2004; code in the public domain. *)
signature SHA1 =
sig
(* Perform the SHA-1 hash function on a message.
Returns the 160 bit (20 byte) hash.
recall that string = CharVector.vector.
The input string may contain non-ascii data;
the output certainly will. *)
val hash : string -> string
(* pass in a stream as stateful function that returns
SOME s for some non-empty prefix of the remainder of
the stream, or NONE when the stream has ended. *)
val hash_stream : (unit -> string option) -> string
(* XXX move to hashutil *)
(* convert a binary string to one built of hex digits *)
val bintohex : string -> string
(* Parse a hexadecimal SHA-1 string. Uppercase and lowercase
are permitted. If the string is not the right length or
contains invalid characters, returns NONE. *)
val parse_hex : string -> string option
end
|