With \directlua{context(md5.hex([===[#1]===]))} I can calculate the MD5 checksum. I thought there was another call for the calculation of the SHA checksum, but I could not find it in the documentation or on the context garden. Where to look? dr. Hans van der Meer
On 8/28/2022 12:25 PM, Hans van der Meer via ntg-context wrote:
With \directlua{context(md5.hex([===[#1]===]))} I can calculate the MD5 checksum. I thought there was another call for the calculation of the SHA checksum, but I could not find it in the documentation or on the context garden. Where to look?
have a look at l-sha.lua ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 8/28/22 12:41, Hans Hagen via ntg-context wrote:
On 8/28/2022 12:25 PM, Hans van der Meer via ntg-context wrote:
[...] Where to look? have a look at
l-sha.lua
Hans, I wonder whether https://github.com/Egor-Skriptunoff/pure_lua_SHA may be interesting for ConTeXt. I mean, it is optimized for speed. As the author states: Main feature of this module: it was heavily optimized for speed. I think it may be interesting to be considered for ConTeXt. Just in case it might help, Pablo
On 8/28/22 12:25, Hans van der Meer via ntg-context wrote:
With \directlua{context(md5.hex([===[#1]===]))} I can calculate the MD5 checksum. I thought there was another call for the calculation of the SHA checksum, but I could not find it in the documentation or on the context garden. Where to look?
Dear dr. van der Meer, it is my fault since Hans explained this before (to me). Here you have the minimal sample: \ctxlua{require("util-sha")} \def\shatwo#1{% \cldcontext{utilities.sha2.hash256("#1")}} \def\shafive#1{% \cldcontext{utilities.sha2.hash512("#1")}} \def\shatwofile#1{% \cldcontext{utilities.sha2.hash256(io.loaddata("#1"))}} \def\shafivefile#1{% \cldcontext{utilities.sha2.hash512(io.loaddata("#1"))}} \starttext \def\testtext{abc} \def\testfile{xml-mkiv.pdf} \shatwo{\testtext}\\ \shafive{\testtext} \shatwofile{\testfile}\\ \shafivefile{\testfile} \stoptext Would you be so kind to add it to the wiki? I hope it may help, Pablo
On 28 Aug 2022, at 19:07, Pablo Rodriguez via ntg-context
wrote: On 8/28/22 12:25, Hans van der Meer via ntg-context wrote:
With \directlua{context(md5.hex([===[#1]===]))} I can calculate the MD5 checksum. I thought there was another call for the calculation of the SHA checksum, but I could not find it in the documentation or on the context garden. Where to look?
Dear dr. van der Meer,
it is my fault since Hans explained this before (to me).
You absolutely need not to apologize. The answer of Hans Hagen was quite sufficient for me and \def\SHA#1{\directlua{tex.sprint(sha2.hash256([===[#1]===]))}} was all I needed. I know Hans from ages ago and he knows what I need in cases like this. Alas, wikifying is not my thing. Hans van der Meer\
participants (3)
-
Hans Hagen
-
Hans van der Meer
-
Pablo Rodriguez