diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2016-10-23 14:26:59 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2016-10-23 14:26:59 -0400 |
commit | 235602373c04aa38b7f8c93e6efbd9276ecc2266 (patch) | |
tree | 97c39e67902dd84d088ab930d8675e90760a674a /src/sha1.sig | |
parent | c921d0df325c803fed8c7742eb088cb3d030d541 (diff) | |
parent | 20f3308b8c2a5a331239839e222bd21befde73eb (diff) |
Merge branch 'upstream' into dfsg_clean20161022+dfsg
Diffstat (limited to 'src/sha1.sig')
-rw-r--r-- | src/sha1.sig | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sha1.sig b/src/sha1.sig new file mode 100644 index 00000000..7fda97f5 --- /dev/null +++ b/src/sha1.sig @@ -0,0 +1,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 |