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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#66698: closed (I think hex decoding with basenc -d --base16
 should be case-insensitive)
Date: Mon, 23 Oct 2023 12:02:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 23 Oct 2023 13:01:17 +0100
with message-id <9cb30d1b-3f3d-5d3a-59ab-5ee630ea633f <at> draigBrady.com>
and subject line Re: bug#66698: I think hex decoding with basenc -d --base16 should be case-insensitive
has caused the debbugs.gnu.org bug report #66698,
regarding I think hex decoding with basenc -d --base16 should be case-insensitive
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
66698: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66698
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Niels Möller <nisse <at> lysator.liu.se>
To: bug-coreutils <at> gnu.org
Subject: I think hex decoding with basenc -d --base16 should be
 case-insensitive
Date: Mon, 23 Oct 2023 11:37:36 +0200
Hi,

the docs for basenc --base16 says "hex encoding (RFC4648 section 8)".
The referenced section in that RFC says 

  Essentially, Base 16 encoding is the standard case-insensitive hex
  encoding and may be referred to as "base16" or "hex".

I think it would be both more useful, and consistent with docs, if
basenc -d --base16 accepted either upper- or lowercase hex digits.

Current behavior, with basenc (GNU coreutils) 9.1:

  $ echo 666F6F0A |basenc --base16 -d
  foo
  $ echo 666F6f0A |basenc --base16 -d
  fobasenc: invalid input

I think both inputs should give the same output, "foo\n", at least by
default. Possibly configurable with options like --strict, --upper,
--lower, etc (--upper/--lower would be useful also for the --base16
encoding, i.e., no -d).

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.



[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Niels Möller <nisse <at> lysator.liu.se>,
 66698-done <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 13:01:17 +0100
[Message part 4 (text/plain, inline)]
On 23/10/2023 10:37, Niels Möller wrote:
> Hi,
> 
> the docs for basenc --base16 says "hex encoding (RFC4648 section 8)".
> The referenced section in that RFC says
> 
>    Essentially, Base 16 encoding is the standard case-insensitive hex
>    encoding and may be referred to as "base16" or "hex".
> 
> I think it would be both more useful, and consistent with docs, if
> basenc -d --base16 accepted either upper- or lowercase hex digits.
> 
> Current behavior, with basenc (GNU coreutils) 9.1:
> 
>    $ echo 666F6F0A |basenc --base16 -d
>    foo
>    $ echo 666F6f0A |basenc --base16 -d
>    fobasenc: invalid input
> 
> I think both inputs should give the same output, "foo\n", at least by
> default. Possibly configurable with options like --strict, --upper,
> --lower, etc (--upper/--lower would be useful also for the --base16
> encoding, i.e., no -d).

Agreed.
Will apply the attached later.
Marking this as done.

thanks,
Pádraig
[basenc-lower-hex.patch (text/x-patch, attachment)]

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.