From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: GNAT.SHA256 produces result different from sha257sum on Linux Date: Sat, 4 Nov 2023 18:49:58 +0200 Organization: Tidorum Ltd Message-ID: References: <87bkc9h9au.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net mglADFlhDgVCXshnP5Jq1gnfUwSehitq4TBfnFj3eU15q5ZLYo Cancel-Lock: sha1:sY+Gt4u2HfG5ypI8w6A6oHGzLxM= sha256:a1UoL3jmMpvYuY/r96SMkaQW9slJoJ1rZWAKQGSS4H8= User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65839 List-Id: 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).