Comparison

libs/hashes.lua @ 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
parent 414:2a5eff919f4a
child 422:ff59e4a1a600
comparison
equal deleted inserted replaced
420:459305b2314f 421:f35cfdff31b6
42 with("bgcrypto.sha512", function (sha512) 42 with("bgcrypto.sha512", function (sha512)
43 _M.sha512 = sha512.digest; 43 _M.sha512 = sha512.digest;
44 _M.hmac_sha512 = sha512.hmac.digest; 44 _M.hmac_sha512 = sha512.hmac.digest;
45 end); 45 end);
46 46
47 with("sha1", function (sha1)
48 _M.sha1 = function (data, hex)
49 if hex then
50 return sha1.sha1(data);
51 else
52 return (sha1.binary(data));
53 end
54 end;
55 end);
56
47 return _M; 57 return _M;