This is an automated email from the git hooks/post-receive script.

ecc-guest pushed a commit to branch upstream
in repository approx.

commit 527d48fab7ab93dfe1d75941858459192cdc8909
Author: Eric Cooper <e...@cmu.edu>
Date:   Tue Jul 25 12:24:37 2017 -0400

    Revert "use cryptokit for checksum functions"
    
    This reverts commit 36482244190b748a6f63ebd8006dfca94d304543.
---
 _tags   |  4 ++--
 util.ml | 29 +++++++++++++++--------------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/_tags b/_tags
index 3574409..ee83e10 100644
--- a/_tags
+++ b/_tags
@@ -8,10 +8,10 @@
 <config_file.ml>: package(pcre)
 <log.ml>: package(netsys)
 <url.ml>: package(netstring)
-<util.ml>: package(cryptokit)
+<util.ml>: package(sha)
 <import.ml>: package(pcre)
 
-<**/*.{byte,native}>: package(netsys), package(pcre), package(cryptokit)
+<**/*.{byte,native}>: package(netsys), package(pcre), package(sha)
 <approx.{byte,native}>: package(nethttpd)
 
 <tests/*>: package(oUnit)
diff --git a/util.ml b/util.ml
index b2bee90..3cf8858 100644
--- a/util.ml
+++ b/util.ml
@@ -301,20 +301,21 @@ let iter_dirs = iter_of_fold fold_dirs
 
 let iter_non_dirs = iter_of_fold fold_non_dirs
 
-let to_hex s =
-  let n = String.length s in
-  let hex = Bytes.create (2*n) in
-  for i = 0 to n-1 do
-    Bytes.blit_string (sprintf "%02x" (Char.code s.[i])) 0 hex (2*i) 2
-  done;
-  hex
-
-let hash_file hash file =
-  to_hex (with_in_channel open_in file (Cryptokit.hash_channel hash ?len:None))
-
-let file_md5sum = hash_file (Cryptokit.Hash.md5 ())
-let file_sha1sum = hash_file (Cryptokit.Hash.sha1 ())
-let file_sha256sum = hash_file (Cryptokit.Hash.sha256 ())
+module type MD =
+  sig
+    type t
+    val file : string -> t
+    val to_hex : t -> string
+  end
+
+module FileDigest (MsgDigest : MD) =
+  struct
+    let sum file = MsgDigest.to_hex (MsgDigest.file file)
+  end
+
+let file_md5sum = let module F = FileDigest(Digest) in F.sum
+let file_sha1sum = let module F = FileDigest(Sha1) in F.sum
+let file_sha256sum = let module F = FileDigest(Sha256) in F.sum
 
 let user_id =
   object

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/approx.git

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to