A command-line program for detecting, decoding, and converting radix-encoded strings.
This program is meant to be used with the most popular base-encodings such as base64, hexadecimal, binary, etc. Also the encodings are expected to be in their most commonly used implementation of each respective radix.
- Duotrigesimal (Base-32)
- Tetrasexagesimal (Base-64)
- Pentoctogesimal (Base-85)*
* Not yet implemented
X - Bi-directional optimization
U - Uni-directional optimization (Row to Column)
. - N/A (No conversion necessary)
Those slots between radices where there is no optimization are instead converted to ASCII first. This was a quick-and-dirty method used after each base-decoding was completed into ASCII. Eventually, every single conversion between radices will be completed so that the program is highly optimized no matter what is being encoded.
As can be seen below, exapnsion can be made simply by creating the necessary function, no other modification is necessary:
# Quick validation if (encoding is decoding): return string # No reason to convert anything if ((encoding != ASCII) and (decoding != ASCII)):# Spool through ASCII conversion if (encoding+'2'+decoding in globals()): # Conversion function exists return globals()[encoding+"2"+decoding](string) else: return conversion(ASCII, decoding, conversion(encoding, ASCII, string)) # recursion, ick! return globals()[encoding+"2"+decoding](string)