Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.4 instead.
Reason given by maintainers: Broken cipher design (secret parameters recoverable without the password). Superseded by 0.2.x.

Vorn

Warning: experimental / educational. Vorn is a custom cipher design. It has not been reviewed by cryptographers and must not be used to protect real secrets. For production use a vetted AEAD such as AES-GCM or ChaCha20-Poly1305 (e.g. via the cryptography package).

Vorn is a zero-dependency Python library that experiments with a symmetric cipher built from dynamic prime-index hopping, alternating modular offsets, a keyed bit permutation, and HMAC-SHA256 authentication (Encrypt-then-MAC).

Installation

pip install vorn

Usage

from vorn import encrypt, decrypt, VornError

password = "correct-horse-battery-staple"
ciphertext = encrypt("Payload 257-ALPHA", password)

try:
    plaintext = decrypt(ciphertext, password).decode("utf-8")
    print(plaintext)
except VornError as e:
    print(f"Decryption error: {e}")

Files

from vorn import encrypt, decrypt

with open("archive.bin", "rb") as src:
    encoded = encrypt(src.read(), "file-encryption-key")

with open("archive.vorn", "w", encoding="ascii") as dst:
    dst.write(encoded)

with open("archive.vorn", "r", encoding="ascii") as src:
    restored = decrypt(src.read(), "file-encryption-key")

Note: the pure-Python implementation is slow and memory hungry, and ciphertext is about 24 characters per plaintext byte. It is meant for small payloads.

Specification

1. Key derivation

A UTF-8 passphrase P and a random 128-bit nonce N are fed to scrypt (n=16384, r=8, p=1) to produce 64 bytes: K_enc (32 bytes, 24 used) || K_pbox (8 bytes) || K_mac (32 bytes).

From K_enc the following parameters are derived:

  • a: one of 16, 24, 32, 40, 48, 56 (a multiple of 8).
  • b: a modular base (3..19) that does not divide a.
  • c: block period a / x with x in {1, 2, 4, 8}.
  • d: polarity bit selecting the initial offset sign.
  • S0_fwd, S0_bwd: initial chaining states (100..999) for the two passes.
  • A keyed 16-element S-Box over nibbles.

2. Round function

Input bytes are split into nibbles and passed through the S-Box. For symbol s_i with previous state C_{i-1} (C_{-1} = S0):

J_i     = a + (C_{i-1} mod 16)
p_i     = Prime[s_i + J_i]
R_i     = (a mod b) + (C_{i-1} mod b)
sigma_i = (-1)^(floor(i / c) + d)
C_i     = p_i + sigma_i * R_i

3. Diffusion

  1. Forward pass over all nibbles using S0_fwd.
  2. States are serialized to bytes, then a keyed Fisher-Yates bit permutation (seeded via BLAKE2b of K_pbox) is applied and the byte stream is reversed.
  3. Backward-direction pass over the resulting nibbles using S0_bwd.

4. Wire format

Everything is serialized as zero-padded 3-digit decimal blocks (000-999):

| nonce: 16 bytes (48 chars) | state stream: 24 * L chars | HMAC-SHA256: 32 bytes (96 chars) |

The MAC covers nonce || state stream and is verified before any decryption work. Any altered digit raises VornError.

Limitations

  • No formal security analysis; the construction is non-standard.
  • Python offers no real constant-time guarantees.
  • Not suitable for large files.

Tests

pip install pytest
python -m pytest

License

MIT

Metadata

Release files for vorn 0.1.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 vorn 0.1.0
File Size Uploaded Provenance Actions
vorn-0.1.0.tar.gz 7.2 kB Without provenance Details for vorn-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / vorn-0.1.0.tar.gz

Download URL vorn-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
64092f38864b0980f84dc03e3fd962507c03045a5d6a585741196e7f4b67622b
BLAKE2b-256 checksum
How to use checksums
ce81a157f57c207a9c1ffea35b5764bfbc9f5bdce78513a815f57cb3dd479800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / vorn-0.1.0-py3-none-any.whl

Download URL vorn-0.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8295f4143cd6fb3ebf52d79bec7ece22f7602b473bb1f6988cb1fd44fd7dac8c
BLAKE2b-256 checksum
How to use checksums
d105f2d4bc4e6da01ed36f2767c21e00f1df04cf83534cf14837c7aa30deac54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for vorn 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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