Changeset

421:f35cfdff31b6

libs.hashes: Add support for sha1 lib from luarocks
author Matthew Wild <mwild1@gmail.com>
date Wed, 27 Jun 2018 19:17:51 +0100
parents 420:459305b2314f
children 422:ff59e4a1a600
files libs/hashes.lua
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;