GNU bug report logs - #66698
I think hex decoding with basenc -d --base16 should be case-insensitive

Previous Next

Package: coreutils;

Reported by: Niels Möller <nisse <at> lysator.liu.se>

Date: Mon, 23 Oct 2023 09:39:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 66698 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Niels Möller <nisse <at> lysator.liu.se>
Cc: 66698 <at> debbugs.gnu.org
Subject: Re: bug#66698: I think hex decoding with basenc -d --base16 should be
 case-insensitive
Date: Mon, 23 Oct 2023 14:08:17 +0100
On 23/10/2023 13:50, Niels Möller wrote:
> Pádraig Brady <P <at> draigBrady.com> writes:
> 
>> Will apply the attached later.
>> Marking this as done.
> 
> Thanks! It would make some sense to me to also have options
> --upper/--lower; on encoding, they would specify case of the output, on
> decoding, they would reject the other case (with default being to accept
> either). But less important than fixing the default behavior.

I was thinking `tr '[:lower:]' '[:upper:]'` would suffice for that when encoding.
When decoding I don't see much need for the strictness, but that could
also be enforced easily by prefiltering with something like `tr 'A-F' x`

The same argument could be made of course for not needing this patch at all,
by prefiltering through tr.  However the default operation should be the
most common requirement (and also the RFC documented operation in this case).
A similar case I hit very frequently is pasting hex into bc, and it's
very annoying to have to convert to uppercase before doing this.

>> +  basenc --base16 -d no supports lower case hexadecimal characters.
>> +  Previously an error was given for lower case hex digits.
> 
> s/ no / now /

Thanks, pushed.

Pádraig.





This bug report was last modified 1 year and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.