util/hashes.lua

changeset 450
e04c4052742c
parent 444
77485b9b840c
parent 449
c0a4a1e63d70
child 451
e9f269e5204e
--- a/util/hashes.lua	Thu Nov 27 23:36:17 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-
-local softreq = function (...) local ok, lib =  pcall(require, ...); if ok then return lib; else return nil; end end
-local error = error;
-
-module "hashes"
-
-local md5 = softreq("md5");
-if md5 then
-	if md5.digest then
-		local md5_digest = md5.digest;
-		local sha1_digest = sha1.digest;
-		function _M.md5(input)
-			return md5_digest(input);
-		end
-		function _M.sha1(input)
-			return sha1_digest(input);
-		end
-	elseif md5.sumhexa then
-		local md5_sumhexa = md5.sumhexa;
-		function _M.md5(input)
-			return md5_sumhexa(input);
-		end
-	else
-		error("md5 library found, but unrecognised... no hash functions will be available", 0);
-	end
-else
-	error("No md5 library found. Install md5 using luarocks, for example", 0);
-end
-
-return _M;

mercurial