From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: GNAT.SHA256 produces result different from sha257sum on Linux
Date: Sat, 4 Nov 2023 18:49:58 +0200 [thread overview]
Message-ID: <kqnb1mFnvc6U1@mid.individual.net> (raw)
In-Reply-To: <ui5ms6$3d0f4$1@dont-email.me>
On 2023-11-04 17:09, Jeffrey R.Carter wrote:
> On 2023-11-04 15:39, wvxvw wrote:
>>
>> ❯ ./bin/test_sha --arg foo
>> 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
>> ❯ echo foo | sha256sum -
>> b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c -
>
> I think the problem may be that echo adds an LF:
>
> $ echo foo | hd
> 00000000 66 6f 6f 0a |foo.|
>
> Since sha256sum expects to work on arbitrary files, it would include the
> LF in its input.
Some implementations of "echo" accept an option "-n" to suppress the
trailing newline (LF). The OP could try that option as a quick check of
this answer (which seems very plausible).
next prev parent reply other threads:[~2023-11-04 16:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-04 14:39 GNAT.SHA256 produces result different from sha257sum on Linux wvxvw
2023-11-04 15:09 ` Jeffrey R.Carter
2023-11-04 16:48 ` wvxvw
2023-11-04 17:53 ` Ben Bacarisse
2023-11-04 19:26 ` wvxvw
2023-11-04 16:49 ` Niklas Holsti [this message]
2023-11-04 17:39 ` Jeffrey R.Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox