v0.2.0
Breaking Change: New Wire Format
This release introduces streaming encryption for large files. The wire format is not backward compatible — files encrypted with v0.2.0 cannot be decrypted by v0.1.x clients. However, v0.2.0 can still decrypt legacy v0.1.x files (backward compatible read).
What's New
Streaming Encryption
Large files are now encrypted in 64KB chunks using Rogaway's STREAM construction:
- Memory efficient: Only one chunk in memory at a time — no more OOM on big files
- Truncation resistant: Last-block flag prevents ciphertext manipulation
- Proven security: STREAM provides nOBE (nonce-reuse misuse resistance)
Wire Format
Header (28 bytes):
[4 bytes] PHNT magic
[4 bytes] Version (1)
[4 bytes] Chunk size (65536)
[4 bytes] Total chunks
[12 bytes] Base nonce
Per chunk:
[12 bytes] Nonce (derived from base + counter + last_flag)
[N bytes] Ciphertext
[16 bytes] GCM auth tag
STREAM Nonce Construction
Each chunk's nonce is derived as:
[7 bytes: base_nonce prefix][4 bytes: counter (BE)][1 byte: last_block_flag]
The last chunk has last_block_flag = 0x01, all others have 0x00. This prevents truncation attacks.
Backward Compatibility
| Client | Decrypts v0.1.x | Decrypts v0.2.0 |
|---|---|---|
| v0.1.x | ✅ Yes | ❌ No |
| v0.2.0 | ✅ Yes (auto-detected) | ✅ Yes |
The DecryptAuto function auto-detects legacy vs streaming format.
Install
# Quick install
curl -sL https://phntm.sh/install | sh
# Or via Homebrew
brew tap aliirz/phntm
brew install phntmWhat's Changed
- Add streaming encryption with STREAM construction by @aliirz in #10
- Full backward compatibility with legacy single-block format
- Comprehensive test suite (10 new tests)
Full Changelog: v0.1.2...v0.2.0