BaseX is a command-line tool for encoding and decoding files using the Base8, Base32, and Base64 formats. It provides a straightforward interface for transforming file content into these formats or decoding them back to their original state.
- Encode files into Base8, Base32, or Base64 formats.
- Decode files from Base8, Base32, or Base64 formats.
- Supports binary file input and produces output via
stdout. - Returns nonzero error codes for invalid input during decoding.
To use BaseX, compile the source code with a C compiler using std C23:
mkdir build | clang -Iinclude -std=c23 src/*.c -o build/basexMake sure that the base8.h, base32.h, and base64.h header files are in projectRoot/include, and source files are in projectRoot/src, or this command will not work.
basex [options] <format> <file><format>: The encoding/decoding format. Valid options are:base8: Base8 (octal) encoding/decoding.base32: Base32 encoding/decoding.base64: Base64 encoding/decoding.
<file>: The path to the file to encode or decode.
-d: Decode the input file.-h: Display the help message and usage instructions.
To encode a file named input.txt in Base64:
basex base64 input.txtTo decode a file named encoded.txt from Base32:
basex -d base32 encoded.txtbasex -h- If the input file is invalid or cannot be opened, an error message is printed to
stderr. - If decoding fails due to invalid input, the program exits with a nonzero error code.