linuxgnu-coreutils

Why not add a base16 into coreutils?


Both base32 and base64 CLI utils are part of gnu coreutils. So, why not add a base16?


Solution

  • writing a script and had the same thought...

    Just looked though the NEWS in coreutils. https://github.com/coreutils/coreutils/blob/master/NEWS

    It looks like they added basenc in release 8.31 (2019-03-10)

    ** New commands - basenc is added to complement existing base64,base32 commands, and encodes and decodes printable text using various common encodings: base64,base64url,base32,base32hex,base16,base2,z85.

    Makes sense to have one command... I've done this other ways in the past xxd, hexdump, etc...

    So they kind of did. Just use basenc --base16

    *Edit, actually it is the same source code for all three https://github.com/coreutils/coreutils/blob/master/src/local.mk

    src_base64_SOURCES = src/basenc.c
    src_base64_CPPFLAGS = -DBASE_TYPE=64 $(AM_CPPFLAGS)
    src_base32_SOURCES = src/basenc.c
    src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS)
    src_basenc_SOURCES = src/basenc.c
    src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)