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
Alphabet is fewer than 3 characters long ValueError
Key is fewer than 3 characters long 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-2.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

substitutionciphers-2.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for substitutionciphers-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7ba0c7cdbaeb66f347e808e876e4679279b468e620a679e0708a32945162f8ea
MD5 b0f8342c4c4d3bb8200d2464e5057966
BLAKE2b-256 a6eea3f3bd7308bf327fd59948328c439690db4dae38695ec09d0e39b1c9f230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substitutionciphers-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81c3163713e995520573e50334fb248e111de27ce6f85353573fa263de290ea2
MD5 c74cb8561c631c4d6cc5e7b655ef4faf
BLAKE2b-256 19baffbad67bc49e5c7f54f40cb182aae8306cad99f9d90618596f4defe24649

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