* SHA calculation
@ 2022-08-28 10:25 Hans van der Meer via ntg-context
2022-08-28 10:41 ` Hans Hagen via ntg-context
2022-08-28 17:07 ` Pablo Rodriguez via ntg-context
0 siblings, 2 replies; 5+ messages in thread
From: Hans van der Meer via ntg-context @ 2022-08-28 10:25 UTC (permalink / raw)
To: NTG ConTeXt; +Cc: Hans van der Meer
[-- Attachment #1.1: Type: text/plain, Size: 278 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 3520 bytes --]
[-- Attachment #2: Type: text/plain, Size: 496 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SHA calculation
2022-08-28 10:25 SHA calculation Hans van der Meer via ntg-context
@ 2022-08-28 10:41 ` Hans Hagen via ntg-context
2022-08-28 17:10 ` Pablo Rodriguez via ntg-context
2022-08-28 17:07 ` Pablo Rodriguez via ntg-context
1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2022-08-28 10:41 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Hans Hagen
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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SHA calculation
2022-08-28 10:25 SHA calculation Hans van der Meer via ntg-context
2022-08-28 10:41 ` Hans Hagen via ntg-context
@ 2022-08-28 17:07 ` Pablo Rodriguez via ntg-context
2022-08-28 17:27 ` Hans van der Meer via ntg-context
1 sibling, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2022-08-28 17:07 UTC (permalink / raw)
To: Hans van der Meer via ntg-context; +Cc: Pablo Rodriguez
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SHA calculation
2022-08-28 10:41 ` Hans Hagen via ntg-context
@ 2022-08-28 17:10 ` Pablo Rodriguez via ntg-context
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2022-08-28 17:10 UTC (permalink / raw)
To: Hans Hagen via ntg-context; +Cc: Pablo Rodriguez
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SHA calculation
2022-08-28 17:07 ` Pablo Rodriguez via ntg-context
@ 2022-08-28 17:27 ` Hans van der Meer via ntg-context
0 siblings, 0 replies; 5+ messages in thread
From: Hans van der Meer via ntg-context @ 2022-08-28 17:27 UTC (permalink / raw)
To: NTG ConTeXt; +Cc: Hans van der Meer
[-- Attachment #1.1: Type: text/plain, Size: 839 bytes --]
> On 28 Aug 2022, at 19:07, Pablo Rodriguez via ntg-context <ntg-context@ntg.nl> 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\
[-- Attachment #1.2: Type: text/html, Size: 2518 bytes --]
[-- Attachment #2: Type: text/plain, Size: 496 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-28 17:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-28 10:25 SHA calculation Hans van der Meer via ntg-context
2022-08-28 10:41 ` Hans Hagen via ntg-context
2022-08-28 17:10 ` Pablo Rodriguez via ntg-context
2022-08-28 17:07 ` Pablo Rodriguez via ntg-context
2022-08-28 17:27 ` Hans van der Meer via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).