Skip to main content

TDE โ€” Tanishq's Decoder & Encoder. A fast, dependency-free multi-format encoding CLI tool (Base64, Hex, Base32, Base85).

Project description

Version Python License Dependencies Platform

๐Ÿ” TDE โ€” Tanishq's Decoder & Encoder

A fast, lightweight, dependency-free CLI tool for multi-format encoding & decoding.
Supports Base64, Hex, Base32, and Base85 โ€” built purely with Python's standard libraries.

Features โ€ข Installation โ€ข Usage โ€ข Formats โ€ข Architecture โ€ข Contributing โ€ข License


โœจ Features

Feature Description
๐Ÿ”„ Multi-Format Encoding Supports Base64, Hex, Base32, and Base85 encoding/decoding out of the box
๐Ÿšซ Zero Dependencies Runs natively using only built-in Python libraries โ€” nothing to install, nothing to break
๐Ÿ–ฅ๏ธ Cross-Platform Works seamlessly on Command Prompt, PowerShell, Git Bash, WSL, and Linux/macOS terminals
๐Ÿ“ File I/O Read from and write directly to files for handling large payloads or binaries
๐ŸŒ URL-Safe Mode Seamlessly handle JSON Web Tokens (JWTs) and URL parameters with - _ alphabet
๐Ÿ›ก๏ธ Strict Validation Catch malformed data streams instantly with --strict mode (all formats)
๐Ÿงน Garbage Collection Force-decode messy inputs by stripping invalid characters automatically
๐Ÿ”„ Pipe Support Chain with other CLI tools via stdin/stdout piping
๐ŸŽจ Coloured Output ANSI colour support with automatic graceful degradation

๐Ÿ“ฆ Installation

Prerequisites: Python 3.7 or higher

Quick Install

pip install tde

Or

git clone https://github.com/tanishqzope/TDE-Tool.git
cd TDE-Tool
pip install .

Once installed, the tde command is globally available from any terminal.

Verify Installation

tde --version
# Output: TDE v1.1.0

๐ŸŽฏ Supported Formats

Format Flag Alphabet Use Case
Base64 --format base64 (default) A-Z a-z 0-9 + / General-purpose encoding, email, MIME
Hex --format hex 0-9 a-f Byte-level inspection, checksums, crypto
Base32 --format base32 A-Z 2-7 Case-insensitive contexts, OTP secrets
Base85 --format base85 ASCII 33โ€“117 Maximum density, PDF internals

Shorthand: Use -f instead of --format for brevity โ€” e.g., tde encode "data" -f hex


๐Ÿš€ Usage

Basic Encoding & Decoding (Base64 โ€” default)

# Encode a string to Base64
tde encode "hello world"
# Output: aGVsbG8gd29ybGQ=

# Decode a Base64 string
tde decode "aGVsbG8gd29ybGQ="
# Output: hello world

๐Ÿ”ข Hex Encoding

# Encode to hexadecimal
tde encode "hello world" --format hex
# Output: 68656c6c6f20776f726c64

# Decode from hex
tde decode "68656c6c6f20776f726c64" --format hex
# Output: hello world

๐Ÿ”ค Base32 Encoding

# Encode to Base32
tde encode "hello world" --format base32
# Output: NBSWY3DPEB3W64TMMQ======

# Decode from Base32
tde decode "NBSWY3DPEB3W64TMMQ======" --format base32
# Output: hello world

๐Ÿ“ฆ Base85 Encoding

# Encode to Base85 (Ascii85)
tde encode "hello world" --format base85
# Output: Xk~0{Zv

# Decode from Base85
tde decode "Xk~0{Zv" --format base85
# Output: hello world

๐ŸŒ URL-Safe Mode (--url)

Generate Base64 strings safe for web transit โ€” replaces +// with -/_ and strips = padding. Perfect for JWTs and URL parameters.

tde encode "https://example.com/api?token=abc" --url
# Output: aHR0cHM6Ly9leGFtcGxlLmNvbS9hcGk_dG9rZW49YWJj

โš ๏ธ --url only applies to --format base64 (the default).

๐Ÿ›ก๏ธ Strict Mode (--strict)

Forces the tool to halt immediately with a clear error if the input contains any invalid characters for the selected format.

# Strict Base64 decode
tde decode "aGVsbG8gd2!9ybGQ=" --strict
# Error: Strict mode: invalid Base64 character(s) found: '!'

# Strict Hex decode
tde decode "68656c6c6fZZ" --format hex --strict
# Error: Strict mode: invalid hex character(s) found: 'Z'

๐Ÿงน Ignore Garbage (--ignore-garbage)

Strips whitespace, newlines, and invalid characters before decoding โ€” perfect for messy copy-paste inputs.

tde decode "aGVsbG8  gd 29ybGQ=" --ignore-garbage
# Output: hello world

๐Ÿ“ File Operations

Read a payload from a file and write the decoded output to a new file:

# Encode a file's contents
tde encode -i secret.txt -o encoded_payload.txt

# Decode back to original
tde decode -i encoded_payload.txt -o original.txt

# Hex-encode a binary file
tde encode -i image.png -o image_hex.txt --format hex

๐Ÿ”„ Piping Support

Chain TDE with other CLI tools:

# Pipe from echo
echo "sensitive data" | tde encode

# Chain with curl
curl -s https://api.example.com/data | tde decode

# Pipe between TDE commands (round-trip)
echo "hello" | tde encode | tde decode

# Round-trip hex verification
echo "hello" | tde encode -f hex | tde decode -f hex

๐Ÿ“‹ Full Help Menu

tde --help
  +========================================+
  |  TDE -- The Data Encoder / Decoder     |
  |  v1.1.0  |  Multi-format Encoder      |
  +========================================+

positional arguments:
  {encode,decode}    Operation to perform: 'encode' or 'decode'.
  data               Inline string payload (optional if using -i or stdin).

I/O options:
  -i, --input FILE   Read payload from FILE instead of stdin/args.
  -o, --output FILE  Write result to FILE instead of stdout.

Encoding format:
  -f, --format FMT   Encoding format: base64 (default), hex, base32, base85.

Advanced modifiers:
  --url              Use URL-safe Base64 alphabet (- _ instead of + /).
  --strict           Halt with an error on any invalid character.
  --ignore-garbage   Strip whitespace and invalid characters before decoding.

๐Ÿ—๏ธ Architecture

High-Level Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    tde <command> [data] [flags]                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    1. ARGUMENT PARSER (argparse)                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ command โ”‚   โ”‚  data   โ”‚   โ”‚ flags  โ”‚   โ”‚   I/O options   โ”‚   โ”‚
โ”‚  โ”‚encode/  โ”‚   โ”‚(inline) โ”‚   โ”‚--url   โ”‚   โ”‚ -i input file   โ”‚   โ”‚
โ”‚  โ”‚decode   โ”‚   โ”‚         โ”‚   โ”‚--strictโ”‚   โ”‚ -o output file  โ”‚   โ”‚
โ”‚  โ”‚         โ”‚   โ”‚         โ”‚   โ”‚-f fmt  โ”‚   โ”‚                 โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚              โ”‚           โ”‚                  โ”‚
        โ–ผ              โ–ผ           โ”‚                  โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          2. INPUT ROUTER         โ”‚                  โ”‚            โ”‚
โ”‚  Priority Hierarchy:             โ”‚                  โ”‚            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚                  โ”‚            โ”‚
โ”‚  โ”‚ 1. File  (-i flag)   โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚  โ”‚ 2. Stdin (piped)     โ”‚        โ”‚                               โ”‚
โ”‚  โ”‚ 3. Arg   (inline)    โ”‚        โ”‚                               โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚                               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                    โ”‚
              โ–ผ                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  3. FORMAT DISPATCHER                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  -f base64 (default)  โ”€โ”€โ–บ Base64 encode/decode engine       โ”‚ โ”‚
โ”‚  โ”‚  -f hex               โ”€โ”€โ–บ Hex encode/decode engine          โ”‚ โ”‚
โ”‚  โ”‚  -f base32            โ”€โ”€โ–บ Base32 encode/decode engine       โ”‚ โ”‚
โ”‚  โ”‚  -f base85            โ”€โ”€โ–บ Base85 encode/decode engine       โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                                                                   โ”‚
โ”‚  โ”Œโ”€ ENCODE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  base64:  b64encode() / urlsafe_b64encode()               โ”‚   โ”‚
โ”‚  โ”‚  hex:     binascii.hexlify()                              โ”‚   โ”‚
โ”‚  โ”‚  base32:  b32encode()                                     โ”‚   โ”‚
โ”‚  โ”‚  base85:  b85encode()                                     โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                                   โ”‚
โ”‚  โ”Œโ”€ DECODE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  --strict?          โ”€โ”€โ–บ regex validate per format          โ”‚   โ”‚
โ”‚  โ”‚  --ignore-garbage?  โ”€โ”€โ–บ regex strip invalid chars          โ”‚   โ”‚
โ”‚  โ”‚  base64:  b64decode() / urlsafe_b64decode()               โ”‚   โ”‚
โ”‚  โ”‚  hex:     binascii.unhexlify()                            โ”‚   โ”‚
โ”‚  โ”‚  base32:  b32decode()                                     โ”‚   โ”‚
โ”‚  โ”‚  base85:  b85decode()                                     โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    4. OUTPUT ROUTER                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  -o flag set?  โ”€โ”€โ–บ Write bytes to file                    โ”‚   โ”‚
โ”‚  โ”‚  (default)     โ”€โ”€โ–บ Print to stdout                        โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Data Flow

User Input โ”€โ”€โ–บ Argument Parser โ”€โ”€โ–บ Input Router โ”€โ”€โ–บ Format Dispatcher โ”€โ”€โ–บ Output Router
                    โ”‚                    โ”‚                  โ”‚                   โ”‚
               Parse command        Read from:         Apply format:       Deliver to:
               & flags             โ€ข File (-i)        โ€ข base64 (default)  โ€ข File (-o)
                                   โ€ข Stdin (pipe)     โ€ข hex               โ€ข Stdout
                                   โ€ข Inline arg       โ€ข base32
                                                      โ€ข base85
                                                      + modifiers:
                                                        --url --strict
                                                        --ignore-garbage

Module Structure

TDE-Tool/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ publish.yml  # PyPI auto-publish on release
โ”œโ”€โ”€ .gitignore           # Git ignore rules
โ”œโ”€โ”€ LICENSE              # MIT License
โ”œโ”€โ”€ README.md            # This file
โ”œโ”€โ”€ setup.py             # Installer with console_scripts entry point
โ””โ”€โ”€ tde/                 # Main package
    โ”œโ”€โ”€ __init__.py      # Version constant (__version__ = "1.1.0")
    โ””โ”€โ”€ cli.py           # Complete CLI implementation
                         #   โ”œโ”€โ”€ ANSI colour helpers
                         #   โ”œโ”€โ”€ Banner & help formatter
                         #   โ”œโ”€โ”€ _acquire_input()        โ†’ Input Router
                         #   โ”œโ”€โ”€ _encode_base64()        โ†’ Base64 encoder
                         #   โ”œโ”€โ”€ _encode_hex()           โ†’ Hex encoder
                         #   โ”œโ”€โ”€ _encode_base32()        โ†’ Base32 encoder
                         #   โ”œโ”€โ”€ _encode_base85()        โ†’ Base85 encoder
                         #   โ”œโ”€โ”€ _encode()               โ†’ Format dispatcher (encode)
                         #   โ”œโ”€โ”€ _decode_base64()        โ†’ Base64 decoder
                         #   โ”œโ”€โ”€ _decode_hex()           โ†’ Hex decoder
                         #   โ”œโ”€โ”€ _decode_base32()        โ†’ Base32 decoder
                         #   โ”œโ”€โ”€ _decode_base85()        โ†’ Base85 decoder
                         #   โ”œโ”€โ”€ _decode()               โ†’ Format dispatcher (decode)
                         #   โ”œโ”€โ”€ _emit()                 โ†’ Output Router
                         #   โ””โ”€โ”€ main()                  โ†’ Entry point

๐Ÿ”ง CLI Reference

Argument Type Description
encode Command Convert input using the selected format
decode Command Decode encoded data back to original
<data> Positional Inline string payload
-i, --input Flag Read payload from a file
-o, --output Flag Write result to a file
-f, --format Option Encoding format: base64 (default), hex, base32, base85
-v, --version Flag Show version (TDE v1.1.0)
-h, --help Flag Show help menu with examples
--url Modifier Use URL-safe Base64 alphabet (Base64 only)
--strict Modifier Error on invalid characters (all formats)
--ignore-garbage Modifier Strip invalid characters before decoding

โš ๏ธ --strict and --ignore-garbage are mutually exclusive โ€” they cannot be used together.

โš ๏ธ --url only applies to --format base64.


๐ŸŽฏ Use Cases

Scenario Command
๐Ÿ”‘ Encode API keys for config files tde encode "sk-abc123secret"
๐ŸŒ Generate URL-safe JWT tokens tde encode "payload" --url
๐Ÿ“ง Decode email attachments tde decode -i attachment.b64 -o file.pdf
๐Ÿงช Validate Base64 integrity tde decode "data..." --strict
๐Ÿ“‹ Clean up messy copy-paste tde decode "broken data" --ignore-garbage
๐Ÿ”„ Round-trip verification echo "test" | tde encode | tde decode
๐Ÿ” Inspect binary as hex tde encode -i binary.dat -f hex
๐Ÿ” Encode OTP secrets (Base32) tde encode "secret" -f base32
๐Ÿ“„ Compact binary (Base85) tde encode -i data.bin -f base85
๐Ÿ”ข Hex round-trip echo "test" | tde encode -f hex | tde decode -f hex

๐Ÿ“‹ Changelog

v1.1.0 โ€” Multi-Format Encoding

  • New: Added --format / -f flag with support for hex, base32, and base85 encoding
  • New: Per-format strict validation and garbage stripping
  • New: Dedicated encode/decode engines for each format
  • Improved: Banner updated to reflect multi-format capability
  • Improved: Help text with examples for all formats
  • Backwards-compatible: Default format remains base64; all existing commands work unchanged

v1.0.0 โ€” Initial Release

  • Base64 encoding & decoding
  • URL-safe mode (--url)
  • Strict validation (--strict)
  • Garbage stripping (--ignore-garbage)
  • File I/O (-i, -o)
  • Pipe support (stdin/stdout)
  • ANSI coloured output

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/awesome-feature)
  3. Commit your changes (git commit -m "Add awesome feature")
  4. Push to the branch (git push origin feature/awesome-feature)
  5. Open a Pull Request

Guidelines

  • Use only Python standard library โ€” no external dependencies
  • Maintain cross-platform compatibility
  • Add comments for complex logic
  • Test on both Windows and Linux/macOS

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ‘ค Author

Tanishq Zope โ€” @tanishqzope


Built with โค๏ธ and pure Python. No dependencies were harmed in the making of this tool.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tde-1.1.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tde-1.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file tde-1.1.0.tar.gz.

File metadata

  • Download URL: tde-1.1.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for tde-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b5615d76d0b7e0624e32e9fdcc7a49db45f057a80421828fc310745fcace0826
MD5 1c86187bd75f88fa4a3da21b3d538a42
BLAKE2b-256 fb49931bfdeccb4bce0a7158c43cdec6f8be8fa8fdbae462f071575d9a11cfcc

See more details on using hashes here.

File details

Details for the file tde-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tde-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for tde-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9678d8c4c2cc3c125fde5da86faea87d35544df13ab59fdd9501b030ea8fc44e
MD5 c406b35c0b6aaa20fb8e27232826f7e8
BLAKE2b-256 4dd8f2b90fe2cc02e109164a9e9952b3c218e2ffecf45e933f7e677b80acea10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page