Skip to main content

The Griffinere cipher is a custom encryption algorithm in C# designed for reversible, base64-normalized encryption using a repeating key. Inspired by the Vigenère cipher, it adds configurable alphabet support, input validation, and padding-based encryption length enforcement.

Project description

Griffinere Cipher 🔐 — Python Edition

The Griffinere cipher is a reversible, Base‑64‑normalised encryption algorithm implemented in pure Python. Inspired by the classic Vigenère cipher, it adds:

  • Configurable alphabets (use any character set you like)
  • Input validation for safer usage
  • Padding‑based length enforcement so encrypted strings meet a minimum length

📦 Installation

pip install substitutionciphers

In your code:

from substitutionciphers import Griffinere

✨ Features

  • 🔐 Encrypts & decrypts alphanumeric or custom‑alphabet strings
  • 🧩 Define your own alphabet (emoji? Cyrillic? go ahead!)
  • 📏 Optional minimum‑length padding for fixed‑width ciphertext
  • ✅ Strong validation of both alphabet and key integrity
  • 🧪 Unit‑tested with pytest

🧰 Usage

1 Create a cipher

1.1 Default alphabet

key = "YourSecureKey"
cipher = Griffinere(key)

The built‑in alphabet is:

A‑Z  a‑z  0‑9

1.2 Custom alphabet

custom_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345"
key = "YOURKEY"
cipher = Griffinere(key, custom_alphabet)
Alphabet rules
  1. Must not contain . (dot)
  2. All characters must be unique
  3. Every character in the key must appear in the alphabet

2 Encrypt & decrypt

2.1 Encrypt a string

plain_text = "Hello World 123"
encrypted = cipher.encrypt_string(plain_text)
# e.g. 'LUKsbK8 OK9ybKJ FC3z'

2.2 Encrypt with a minimum length

encrypted = cipher.encrypt_string(plain_text, minimum_response_length=24)
# e.g. 'cm9JbAxsIJg.LUKsbK8 OK9ybKJ FC3z.Fw'

3.1 Decrypt

decrypted = cipher.decrypt_string(encrypted)
assert decrypted == plain_text

⚠️ Exceptions & validation

Condition Exception
Alphabet contains . ValueError
Duplicate characters in alphabet ValueError
Key contains characters not present in alphabet ValueError
minimum_response_length < 1 ValueError

📄 License

MIT License © 2025 Riley Griffin

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

substitutionciphers-1.0.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

substitutionciphers-1.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file substitutionciphers-1.0.1.tar.gz.

File metadata

  • Download URL: substitutionciphers-1.0.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for substitutionciphers-1.0.1.tar.gz
Algorithm Hash digest
SHA256 40242c4372a33ec2ece6961cc1a984c1300a2c6c6412262d88ad519329c75f7a
MD5 0f5a50d4d9e53f7ef542e839706682a1
BLAKE2b-256 c2370162fbf581be1962d76b8d03cdce5828b7477135418e8097337a6e72b777

See more details on using hashes here.

File details

Details for the file substitutionciphers-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for substitutionciphers-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e09810228ea98927061172336e867f36ff4e3b9ff0d0123541348f6f0abc6df7
MD5 888d706a55dde5a0f44645ab9999b03e
BLAKE2b-256 51b46bb72a9790554bb3b36fcb3422b00fb58940e789aae1a26a00077ae121b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page