High-performance streaming encryption engine for large files
Project description
ciph
Fast, streaming file encryption for large files. Works on files bigger than your RAM.
Install
pip install ciph
ciph setup
Requirements: Linux/Termux, Python >= 3.8, libsodium
# Debian/Ubuntu
sudo apt install libsodium-dev
# Termux
pkg install libsodium
Or build from source:
git clone https://github.com/ankit-chaubey/ciph
cd ciph && make && pip install .
Usage
ciph encrypt video.mp4 # -> video.mp4.ciph
ciph decrypt video.mp4.ciph # -> video.mp4 (filename restored)
Set cipher or chunk size:
ciph encrypt file.bin --cipher chacha -c 8
Non-interactive (scripting):
CIPH_PASSWORD=yourpassword ciph encrypt file.bin
How it works
- AES-256-GCM or ChaCha20-Poly1305 (auto-fallback if no AES-NI)
- Argon2id key derivation from password
- Data key is randomly generated per file, then wrapped with the password key
- File is encrypted in chunks (default 4 MB) so memory usage is constant
- Each chunk gets a unique derived nonce, authenticated with the full header as AAD
- Original filename stored in header, restored on decrypt
- Chunk size used during encrypt is baked into the header -- you can decrypt with any
-cvalue
File format
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | Magic (CIPH) |
| 4 | 1 | Version |
| 5 | 1 | Cipher (1=AES, 2=ChaCha) |
| 6 | 4 | Chunk size MB (big-endian) |
| 10 | 16 | Argon2id salt |
| 26 | 12 | Nonce-derivation key |
| 38 | 1 | Filename length |
| 39 | N | Original filename |
| 39+N | 2 | Encrypted key length |
| 41+N | L | Encrypted data key |
Followed by repeating [4-byte chunk length][encrypted chunk]. A final zero-length authenticated chunk marks EOF.
The entire header is bound as AAD to every chunk -- tampering with any field breaks decryption.
Limitations
- No resume support
- Password-based only (public-key mode not yet implemented)
License
Apache 2.0 -- see LICENSE
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ciph-1.2.2.tar.gz.
File metadata
- Download URL: ciph-1.2.2.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b37ccf72e26bc91ba642e4c434a8ddf1f78a2d025d0e54e3b021e6cfc336719f
|
|
| MD5 |
4bed8d983f433c546ed9574893a196f6
|
|
| BLAKE2b-256 |
f67a82d134b7bc359dc2fdd8b71b4cf4094fe653ff6353ece73813d296dec8d9
|
Provenance
The following attestation bundles were made for ciph-1.2.2.tar.gz:
Publisher:
publish.yml on ankit-chaubey/ciph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ciph-1.2.2.tar.gz -
Subject digest:
b37ccf72e26bc91ba642e4c434a8ddf1f78a2d025d0e54e3b021e6cfc336719f - Sigstore transparency entry: 1761034837
- Sigstore integration time:
-
Permalink:
ankit-chaubey/ciph@38df298a4037aee0c3a221c58bbf1390a03fafc7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@38df298a4037aee0c3a221c58bbf1390a03fafc7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ciph-1.2.2-py3-none-any.whl.
File metadata
- Download URL: ciph-1.2.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab85650bee1844885e4603396f0d48b5f64658b5d40c9426a54a172ef031b784
|
|
| MD5 |
3edea834f165a97b78f001c43f2d8f57
|
|
| BLAKE2b-256 |
9e8ffe01a73fd574916f03876becca790c04ca52a6482529d2a00a8c20b634e1
|
Provenance
The following attestation bundles were made for ciph-1.2.2-py3-none-any.whl:
Publisher:
publish.yml on ankit-chaubey/ciph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ciph-1.2.2-py3-none-any.whl -
Subject digest:
ab85650bee1844885e4603396f0d48b5f64658b5d40c9426a54a172ef031b784 - Sigstore transparency entry: 1761035009
- Sigstore integration time:
-
Permalink:
ankit-chaubey/ciph@38df298a4037aee0c3a221c58bbf1390a03fafc7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ankit-chaubey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@38df298a4037aee0c3a221c58bbf1390a03fafc7 -
Trigger Event:
workflow_dispatch
-
Statement type: