[NTG-context] util-sha.lua misbehaving?

Pablo Rodriguez oinos at gmx.es
Thu Feb 28 18:46:03 CET 2019

Dear list,

I have the following sample:

    function document.capture(cmd, raw)
        local f = assert(io.popen(cmd, 'r'))
        local s = assert(f:read('*a'))
        if raw then return s end
        s = string.gsub(s, '^%s+', '')
        s = string.gsub(s, '%s+$', '')
        s = string.gsub(s, '[\n\r]+', ' ')
        return s

    function document.sha512(file)
        command_output= document.capture("sha512sum -b " .. file)






    \tt i-context.pdf\ss:
         {\rm text: }\hashfive{\cB}}

Just accidentally, I discovered today (using latest beta from 2019.02.26
20:04) that file hashing may be wrong in ConTeXt. For the sake of
brevity, I only use the 8 first chars.

"sha512sum i-context.pdf" gives c4cc3840. Using luajittex, I get that
result. But using Lua 5.3 (and util-sha.lua), I get 44241e9d.

I don’t know whether my invocation of io.loaddata is wrong, since the
SHA512 for the text "i-context.pdf" is 2ac2778b, which is the same
result as https://duckduckgo.com/?q=sha512+i-context.pdf.

After discovering that io.loaddata is from l-io.lua, I don’t know what I
may be doing wrong.

This is an essential feature for me in ConTeXt, since it is the way of
showing the integrity of the attached files to a PDF document (mainly
digitally signed documents).

Could anyone tell me what I am missing here?

Many thanks for your help,


More information about the ntg-context mailing list