Skip to main content


PyPI version PyPI downloads CI Release CodeQL License Discord

BASEFWX is a hybrid post-quantum + AEAD encryption toolkit for files and media, with cross-compatible Python, C++, and Java implementations.

It provides:

  • ML-KEM-768 master key wrapping (optional) and AES-GCM payload protection
  • Password-based encryption with Argon2id or PBKDF2
  • fwxAES file encryption with optional normalize wrapper
  • Packetized live fwxAES stream API for transport-agnostic real-time pipelines
  • b512/pb512 reversible encodings and file modes
  • kFM carrier codecs (auto media/audio encode + strict carrier decode)
  • jMG media cipher for images/audio with metadata control (archive_original toggle). Video path is temporarily disabled in Python unless BASEFWX_ENABLE_JMG_VIDEO=1.
  • C++ library and CLI with Python/C++/Java format parity
  • Java (JVM) library and CLI for cross-compatible fwxAES/b512/pb512/b256/jMG/kFM

Quick Start

pip install basefwx
python -m basefwx cryptin aes-light file.bin -p "password" --strip
python -m basefwx cryptin aes-light file.bin.fwx -p "password"
python -m basefwx n10-enc "hello"
python -m basefwx n10-dec "<digits>"
python -m basefwx kFMe photo.png -o photo.wav            # image/media -> audio carrier
python -m basefwx kFMe track.mp3 -o track.png --bw       # audio -> image carrier
python -m basefwx kFMd photo.wav -o photo-restored.png   # strict decode
python -m basefwx kFMd track.png -o track-restored.mp3
python -m basefwx cryptin fwxaes video.mp4 -p "password"            # Python default: no-archive
python -m basefwx cryptin fwxaes video.mp4 -p "password" --archive  # exact-restore trailer

Notes:

  • kFMd only decodes BaseFWX carriers; it refuses plain WAV/PNG/MP3/M4A files.
  • kFAe / kFAd remain available as deprecated aliases to kFMe / kFMd.
  • Release support policy is single-version: only the latest release is maintained; all older releases are immediately unsupported.
  • Optional kFM/kFA acceleration:
    • BASEFWX_KFM_ACCEL=auto|cuda|cpu (default auto)
    • BASEFWX_KFM_ACCEL_MIN_BYTES=<bytes> (default 1048576, auto mode threshold)
  • CLI progress now includes live system telemetry (CPU/GPU/RAM/I/O/TEMP when available). Disable with BASEFWX_PROGRESS_TELEMETRY=0.
  • Python n10 was optimized for large payloads, but compiled runtimes (C++/Java) are still expected to benchmark faster for very large text workloads.

Python API quick refs:

from basefwx import n10encode, n10decode, n10encode_bytes, n10decode_bytes
from basefwx import kFMe, kFMd
from basefwx import LiveEncryptor, LiveDecryptor, jMGe, jMGd

digits = n10encode("hello")
text = n10decode(digits)
blob_digits = n10encode_bytes(b"\x00\x01\x02")
blob = n10decode_bytes(blob_digits)

carrier = kFMe("input.mp3", output="input.png", bw_mode=True)
restored = kFMd("input.png", output="restored.mp3")

# jMG Python default is no-archive (smaller, non-byte-identical restore)
jMGe("clip.m4a", "password", output="clip.small.m4a")
jMGe("cover.png", "password", output="cover.exact.png", archive_original=True)
jMGd("clip.small.m4a", "password", output="clip.out.m4a")

# Live packetized stream encryption/decryption
enc = LiveEncryptor("password", use_master=False)
dec = LiveDecryptor("password", use_master=False)
wire = [enc.start(), enc.update(b"chunk-1"), enc.update(b"chunk-2"), enc.finalize()]
plain_chunks = []
for packet in wire:
    plain_chunks.extend(dec.update(packet))
dec.finalize()

# ffmpeg pipe helpers for live media transport
from basefwx import fwxAES_live_encrypt_ffmpeg, fwxAES_live_decrypt_ffmpeg
fwxAES_live_encrypt_ffmpeg(
    ["ffmpeg", "-hide_banner", "-loglevel", "error", "-i", "input.m4a", "-f", "matroska", "-c", "copy", "-"],
    "stream.live.fwx",
    "password",
    use_master=False,
)
fwxAES_live_decrypt_ffmpeg(
    "stream.live.fwx",
    ["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-f", "matroska", "-i", "-", "-c", "copy", "restored.mkv"],
    "password",
    use_master=False,
)

Hardware acceleration (Python jMG):

  • BASEFWX_HWACCEL=auto (default), nvenc, qsv, vaapi, or off
  • BASEFWX_HWACCEL_STRICT=1 to fail instead of CPU fallback when requested accel is unavailable

Optional extras:

pip install basefwx[argon2]

Documentation

License

See https://basefwx.fixcraft.jp/LICENCE.

Metadata

Release files for basefwx 3.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basefwx 3.7.0
File Size Uploaded
basefwx-3.7.0.tar.gz 115.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for basefwx 3.7.0
File Interpreter ABI Platform
basefwx-3.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 248.7 kB

Release files / basefwx-3.7.0.tar.gz

Download URL basefwx-3.7.0.tar.gz
Size 115.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f5158bd4f1930bc94deccc28dda20467977eb8cfef524b6685a45cd5e94c43ad
BLAKE2b-256 checksum
How to use checksums
c3e66f7bad20898953661e56bea865ee00f41d08597d483001a7bb2d20c2d6b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / basefwx-3.7.0-py3-none-any.whl

Download URL basefwx-3.7.0-py3-none-any.whl
Size 132.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49e786e2dc831393335a488677b3c0c5e36055950d7dd42f7693108386018ef5
BLAKE2b-256 checksum
How to use checksums
f73472668a685e3072b560e49498c7fb74535b7729ce3800003bf12a0ac2829c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

3.7.0 This release

2 release files

3.6.4

2 release files

3.6.3

2 release files

3.6.2

2 release files

3.6.1

2 release files

3.5.3

2 release files

3.5.2

2 release files

3.4.0

2 release files

3.3.1

2 release files

3.2

2 release files

3.1

2 release files

3.0

2 release files

2.9

2 release files

2.8

2 release files

2.7

2 release files

2.6

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page