[NTG-context] new hash for buffer (as file)

Pablo Rodriguez oinos at gmx.es
Thu Sep 22 19:25:23 CEST 2022

Dear list,

playing with buffer contents, I have the following file:


  just a test
  and another one






  \savebuffer[test][temporary-αβγ, prefix=no]


  \attachment[buffer=test, name=\shabufferfile{test}, method=hidden]

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).

An approach would be the following one. If I’m not totally wrong,
may be just replacing new lines with "\n" in the original buffer

The function string.replacenewlines() is defined at

If I’m not totally wrong about savebuffer replacing newlines with "\n",
I wonder how to create a temporary buffer with such a replacement, so
that it could be hashed later.

I hope my question is clear.

Many thanks in advance for your help,


More information about the ntg-context mailing list