ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: Max Chernoff via ntg-context <ntg-context@ntg.nl>
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: Re: new hash for buffer (as file)
Date: Fri, 23 Sep 2022 17:06:45 +0200	[thread overview]
Message-ID: <96507c65-6273-36b6-463b-0cd68e2c7f01@gmx.es> (raw)
In-Reply-To: <6ebdfae4256fb8b52e941e66ced7a5e7f4b016f8.camel@telus.net>

On 9/23/22 06:01, Max Chernoff via ntg-context wrote:
> […]
> The SHA calculation isn't working properly because of a weird newline
> issue. Try this:
> […]
>        function sha256(str)
>            return utilities.sha2.hash256(
>                str:gsub(string.char(0x0D), string.char(0x0A))
>            )
>        end
> […]

Hi Max,

this works perfectly fine with Linux "str:gsub('\r','\n')", but I can’t
make it work in Windows.

I always thought that Unix used LF (\n, if I’m not wrong) to mark a new
line, and Windows used CRLF (\r\n).

How are new lines marked in the buffer? As \r instead of \r\n or \n?

At least, Notepad (the minimal plain text editor in Windows) doesn’t
recognize newlines if I attach the buffer to the PDF document as a .txt
file.

Many thanks for your 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
___________________________________________________________________________________

  reply	other threads:[~2022-09-23 15:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 17:25 Pablo Rodriguez via ntg-context
2022-09-23  4:01 ` Max Chernoff via ntg-context
2022-09-23 15:06   ` Pablo Rodriguez via ntg-context [this message]
2022-09-25 17:59     ` Pablo Rodriguez via ntg-context
2022-09-26  0:05       ` Max Chernoff via ntg-context
2022-09-26  8:47         ` Hans Hagen via ntg-context
2022-09-26 23:01           ` Max Chernoff via ntg-context
2022-09-26 17:24         ` Pablo Rodriguez via ntg-context
2022-09-26 18:07           ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96507c65-6273-36b6-463b-0cd68e2c7f01@gmx.es \
    --to=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).