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

Pablo Rodriguez oinos at gmx.es
Sun Sep 25 19:59:06 CEST 2022

On 9/23/22 17:06, Pablo Rodriguez via ntg-context wrote:
> On 9/23/22 06:01, Max Chernoff via ntg-context wrote:
>> […]
>>            return utilities.sha2.hash256(
>>                str:gsub(string.char(0x0D), string.char(0x0A))
>>            )
> […]
> this works perfectly fine with Linux "str:gsub('\r','\n')", but I can’t
> make it work in Windows.

Hi again Max,

this seems to solve the issue in Windows too:

  just a test
  and another one


  function sha256(str)
    if os.name == "windows" then
      return utilities.sha2.hash256(str:gsub("\r", "\r\n"))
      return utilities.sha2.hash256(str:gsub("\r", "\n"))




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



But now I don’t understand is the following issue: if the saved file
contains "\r\n", why does basic Notepad the new lines?

"\r\n" are the chars to get new lines in Windows. Or what am I missing here?

Many thanks for your help,


More information about the ntg-context mailing list