Python Base32 Codec CLI
Python Base32 Codec — a runnable python project with source, install and run commands, and expected output.
Project
py-base32-cli
Entry point: b32.py
Install
python b32.py encode helloRun
python b32.py encode helloTest
pytest b32_test.pyExpected output
Encodes or decodes base32 (RFC 4648) without padding.Dependencies
- python >=3.10
Verification evidence
Source reviewed against python standard library APIs. Commands verified for syntax; execution not yet exercised in CI.
Security note
Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.
What it does
Python Base32 Codec CLI is a self-contained python command-line program. Encodes or decodes base32 (RFC 4648) without padding.
Install and run
python b32.py encode hello
python b32.py encode hello
Project structure
py-base32-cli/
├── b32.py
└── README snippet above
Key source
# b32.py
import base64, sys
op, s = sys.argv[1], sys.argv[2]
if op == "encode":
print(base64.b32encode(s.encode()).decode().rstrip("="))
else:
pad = "=" * (-len(s) % 8)
print(base64.b32decode(s + pad).decode())
Testing
pytest b32_test.py
Expected output
When run with the documented command, the program prints:
NBSWY3DP (base32 of "hello")
This expected output describes the verified behavior of the core logic; the surrounding harness (argument parsing, file I/O) is reviewed but not yet executed in CI, hence runnability is marked unverified.
Limitations
- The program is a single-file CLI with no external service dependencies.
- Argument validation is minimal; invalid input produces a runtime error rather than a friendly message.
- Execution has been reviewed for correctness but not yet exercised in an automated CI run.