libs.hashes: Add support for sha1 lib from luarocks

Wed, 27 Jun 2018 19:17:51 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 27 Jun 2018 19:17:51 +0100
changeset 421
f35cfdff31b6
parent 420
459305b2314f
child 422
ff59e4a1a600

libs.hashes: Add support for sha1 lib from luarocks

libs/hashes.lua file | annotate | diff | comparison | revisions
--- a/libs/hashes.lua	Wed Jun 27 19:16:25 2018 +0100
+++ b/libs/hashes.lua	Wed Jun 27 19:17:51 2018 +0100
@@ -44,4 +44,14 @@
 	_M.hmac_sha512 = sha512.hmac.digest;
 end);
 
+with("sha1", function (sha1)
+	_M.sha1 = function (data, hex)
+		if hex then
+			return sha1.sha1(data);
+		else
+			return (sha1.binary(data));
+		end
+	end;
+end);
+
 return _M;

mercurial