[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: diffutils-3.9 released [stable]
From: |
Simon Josefsson |
Subject: |
Re: diffutils-3.9 released [stable] |
Date: |
Tue, 17 Jan 2023 01:13:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Jim Meyering <jim@meyering.net> writes:
>> What utility is used to produce the base64 encoded SHA256 checksum so
>> described? So that this published checksum may be easily verified?
>>
>> Isn't there a missing '=' padding character at the end of the base64
>> encoding? Isn't that needed to properly decode it? For all SHA256
>> sized checksums?
>>
>> $ echo 2A076QogGGjeg9eNrTQTrYgWDMU7zDbrnq98INvwI/E | base64 -d >
>> /dev/null
>> base64: invalid input
>>
>> $ echo $(sha256sum diffutils-3.9.tar.xz | awk '{print$1}' | xxd -r -p |
>> base64) diffutils-3.9.tar.xz
>> 2A076QogGGjeg9eNrTQTrYgWDMU7zDbrnq98INvwI/E= diffutils-3.9.tar.xz
>>
>> I realize that I may do this following method to verify the file. But
>> this seems like quite a bit more work than if the sha256sum hash were
>> given plainly. Plus one must know to add the '=' padding.
>>
>> $ echo $(echo 2A076QogGGjeg9eNrTQTrYgWDMU7zDbrnq98INvwI/E= | base64 -d |
>> xxd -c0 -p) diffutils-3.9.tar.xz
>> d80d3be90a201868de83d78dad3413ad88160cc53bcc36eb9eaf7c20dbf023f1
>> diffutils-3.9.tar.xz
>>
>> $ echo $(echo 2A076QogGGjeg9eNrTQTrYgWDMU7zDbrnq98INvwI/E= |
>> base64 -d | xxd -c0 -p) diffutils-3.9.tar.xz | sha256sum -c
>> diffutils-3.9.tar.xz: OK
>>
>> What useful base64 sha256sum utility am I missing?
>
> Hi Bob,
> That's a good question.
> Simon (I think you added this), what do you use?
> I hope it will be added to coreutils' cksum.
Yes that is a good question -- base64-support should be added to
digest.c in my opinion.
For hash checking I believe base64 formats should work automatically
with -c as well and not need any other command-line parameter.
To generate base64-encoded hashes, a new parameter like -e,--base64
seems relevant. Other thoughts on how the interface should be?
Should we support this for the non-cksum tools? One aspect is code
size: maybe it is okay to increase cksum with base64-support but let the
old tool sha256 not link to to base64 -- I haven't checked how things
are implemented, maybe having different approaches for different tools
is complicated. If so, having the same support in cksum and sha256 is
simplest.
The missing '=' was intentional but can always be discussed. Since the
hash size is fixed, the base encoding padding character is not important
and looked ugly to me. I think the tool should support both string with
and without the padding.
/Simon
signature.asc
Description: PGP signature