From 5c6357cdb820b4f628d036ba7b2248f221d50c0b Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Fri, 22 Feb 2019 23:11:47 +0000 Subject: ConTeXt version 2019.02.22 19:35 git-svn-id: svn://tug.org/texlive/trunk@50086 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/mkiv/l-sha.lua | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Master/texmf-dist/tex/context/base/mkiv/l-sha.lua (limited to 'Master/texmf-dist/tex/context/base/mkiv/l-sha.lua') diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-sha.lua b/Master/texmf-dist/tex/context/base/mkiv/l-sha.lua new file mode 100644 index 00000000000..8481f7f45e8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkiv/l-sha.lua @@ -0,0 +1,27 @@ +if not modules then modules = { } end modules ['l-sha'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +if sha2 then + + local lpegmatch = lpeg.match + local lpegpatterns = lpeg.patterns + local bytestohex = lpegpatterns.bytestohex + local bytestoHEX = lpegpatterns.bytestoHEX + + local digest256 = sha2.digest256 + local digest384 = sha2.digest384 + local digest512 = sha2.digest512 + + sha2.hash256 = function(str) return lpegmatch(bytestohex,digest256(str)) end + sha2.hash384 = function(str) return lpegmatch(bytestohex,digest384(str)) end + sha2.hash512 = function(str) return lpegmatch(bytestohex,digest512(str)) end + sha2.HASH256 = function(str) return lpegmatch(bytestoHEX,digest256(str)) end + sha2.HASH384 = function(str) return lpegmatch(bytestoHEX,digest384(str)) end + sha2.HASH512 = function(str) return lpegmatch(bytestoHEX,digest512(str)) end + +end -- cgit v1.2.3