GNU bug report logs -
#66698
I think hex decoding with basenc -d --base16 should be case-insensitive
Previous Next
Full log
Message #22 received at 66698 <at> debbugs.gnu.org (full text, mbox):
On 25/10/2023 02:30, Paul Eggert wrote:
> On 10/23/23 06:08, Pádraig Brady wrote:
>> 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.
>
> Doesn't the isbase16 function also need updating?
Good spot. I'm adding this, and also a test
for this --ignore-garbage case.
diff --git a/src/basenc.c b/src/basenc.c
isbase16 (char ch)
{
- return ('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'F');
+ return isxdigit (to_uchar (ch));
}
> Also, shouldn't we do something similar for base 32, for consistency?
I was wondering about that.
I previously checked the RFC which didn't mention lower case for base32.
But thinking about it more we probably should allow lower case for base32.
This is also related to the base64 padding change I think, in that we
might add a --strict option to only accept canonical (upper case base32) inputs.
That would also only accept canonical padding, and canonical encoding
of the trailing bits. For example would reject 'SGVsbG9='. See:
https://eprint.iacr.org/2022/361.pdf
thanks,
Pádraig.
This bug report was last modified 1 year and 268 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.