Hi Pablo,

> I mean, to get hash of the file attached to the document, I need to save
> the buffer for "context(utilities.sha2.hash256(io.loaddata(buffer)))".
> But I don’t need to save the buffer to attach it to the PDF document.
> My question is how to define \shabufferfile to avoid \savebuffer (only
> required to get the hash).

The SHA calculation isn't working properly because of a weird newline
issue. Try this:

   just a test
   and another one
       function sha256(str)
           return utilities.sha2.hash256(
               str:gsub(string.char(0x0D), string.char(0x0A))
   \savebuffer[test][temporary-αβγ, prefix=no]
   \attachment[buffer=test, name=\shabuffer{test}, method=hidden]
You can remove the "\savebuffer" and the "\shafile"; I just kept that in to
show that the two hashes are now the same.

-- Max
If your question is of interest to others as well, please add an entry to the 

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

Reply via email to