neva256 — NEVA-256 for Python
Port bit-exact dari implementasi TypeScript di src/neva/neva.ts.
Ciphertext yang dihasilkan kompatibel lintas bahasa (diverifikasi lewat
known-answer test + uji silang Python ↔ Node).
⚠️ EKSPERIMENTAL. NEVA belum pernah dianalisis kriptografer. Jangan pakai untuk melindungi data rahasia sungguhan — gunakan AES-256-GCM, libsodium, atau
cryptographyuntuk produksi. Cocok untuk: belajar, CTF, obfuscation, watermark, dan eksperimen.
Instalasi
pip install neva256 # pure Python (jalan di mana saja)
pip install "neva256[fast]" # + akselerator Rust/PyO3 (~360x lebih cepat)
Dari repo ini:
cd python && pip install -e . # pure Python
cd python/rust && pip install maturin && maturin develop --release # + native
Backend native dipakai otomatis bila tersedia, dan jatuh kembali ke pure Python
kalau tidak. Eksplisit: NevaCipher(key, nonce, use_native=True/False); cek
cipher.backend ("native" atau "python") dan konstanta NATIVE_AVAILABLE.
Pemakaian
from neva256 import NevaCipher, generate_key, generate_nonce
key = generate_key() # simpan ini (32 byte)
nonce = generate_nonce() # acak per pesan (16 byte)
cipher = NevaCipher(key, nonce)
blob = cipher.encrypt_text("halo dunia 🌪️") # string base64 (ct || tag)
print(cipher.decrypt_text(blob)) # 'halo dunia 🌪️'
# bytes
data = b"\x00\x01\x02"
sealed = cipher.encrypt_bytes(data)
assert cipher.decrypt_bytes(sealed) == data
# mode toleran kerusakan: 1 byte rusak hanya merusak ~5 byte sekitarnya
partial = cipher.decrypt_bytes(corrupted, verify=False)
Salah kunci atau ciphertext yang diubah → NevaError
(integrity check failed).
CLI
neva256 keygen
neva256 enc "rahasia" --key <64-hex>
neva256 dec "<nonceHex>:<base64>" --key <64-hex>
echo "teks dari pipe" | neva256 enc - --key <64-hex>
Test
cd python
python -m unittest discover -s tests -v
Test mencakup known-answer vectors dari implementasi TypeScript, round-trip (a–4 KB), deteksi tamper, validasi ukuran key/nonce, dan sifat self-synchronizing.
Catatan keamanan
Lihat src/neva/README.md untuk matriks serangan lengkap: differential per
round, kurva sensitivitas rotasi, hill-climbing, SMT/Z3, dan temuan
equivalent-key pada versi 1-swirl. Ringkasnya: implementasi ini memakai
4 swirl dengan margin satu round di atas ambang kebersihan statistik
terukur — tapi statusnya tetap eksperimental.
Performa (terukur di aarch64)
| Backend | Encrypt 1 MB | Throughput |
|---|---|---|
| Pure Python | 31.3 s | 0.03 MB/s |
| Native (Rust/PyO3) | 87 ms | 11.5 MB/s |
Native ~360× lebih cepat dan melepas GIL: 4 thread paralel = 2.5× speedup pada mesin uji. Implementasi TypeScript ~3 MB/s (native Rust ~4× lebih cepat dari itu). Untuk teks/payload kecil, pure Python sudah cukup.
Metadata
Release files for neva256 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| neva256-0.1.0.tar.gz | 8.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neva256-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / neva256-0.1.0.tar.gz
| Download URL | neva256-0.1.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
862810d41b638dfcdafc467af9f98a7ac980e3330e4ad74aa43d880cfee57465
|
|
BLAKE2b-256 checksum How to use checksums |
8eb4d0d4901197fc85604e59054f3e1cb3049d54dd9ee66357db902df05e518a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / neva256-0.1.0-py3-none-any.whl
| Download URL | neva256-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9789febe06690a17fd3906e05e69befe4107bc41279d3513935f9c34d4a05747
|
|
BLAKE2b-256 checksum How to use checksums |
4067b353f71354e78d53e6ba521d4ce7874abd85c76b93767f5fe44687f39d4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for neva256 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.