mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
basenc: --base16: support lower case hex digits
* src/basenc.c (base16_decode_ctx): Convert to uppercase before converting from hex. * tests/basenc/basenc.pl: Add a test case. * NEWS: Mention the change in behavior. Addresses https://bugs.gnu.org/66698
This commit is contained in:
3
NEWS
3
NEWS
@@ -19,6 +19,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
base32 and base64 no longer require padding when decoding.
|
||||
Previously an error was given for non padded encoded data.
|
||||
|
||||
basenc --base16 -d now supports lower case hexadecimal characters.
|
||||
Previously an error was given for lower case hex digits.
|
||||
|
||||
ls --dired now implies long format output without hyperlinks enabled,
|
||||
and will take precedence over previously specified formats or hyperlink mode.
|
||||
|
||||
|
||||
@@ -577,7 +577,7 @@ base16_decode_ctx (struct base_decode_context *ctx,
|
||||
continue;
|
||||
}
|
||||
|
||||
int nib = *in++;
|
||||
int nib = c_toupper (*in++);
|
||||
if ('0' <= nib && nib <= '9')
|
||||
nib -= '0';
|
||||
else if ('A' <= nib && nib <= 'F')
|
||||
|
||||
@@ -159,6 +159,7 @@ my @Tests =
|
||||
['b16_7', '--base16 -d', {IN=>'G'}, {EXIT=>1},
|
||||
{ERR=>"$prog: invalid input\n"}],
|
||||
['b16_8', '--base16 -d', {IN=>"AB\nCD"}, {OUT=>"\xAB\xCD"}],
|
||||
['b16_9', '--base16 -d', {IN=>lc ($base16_out)}, {OUT=>$base16_in}],
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user