Retro Ciphers
Retro Ciphers is implementations of classical and historical ciphers. It is intended for educational purposes, cryptography enthusiasts, or anyone interested in the history of hidden messages.
This package encompasses both Monoalphabetic and Polyalphabetic substitution ciphers,to include modern interpretations as well as strict, historically accurate 15th-century variants.
Installation
You can easily install retro-ciphers via pip:
pip install retro-ciphers
(Requires Python 3.12 or higher)
Features
retro-ciphers provides clean, object-oriented API access to the following historical ciphers:
Monoalphabetic Ciphers
- Atbash: The classic Hebrew reversal cipher.
- Caesar / Shift / ROT13: Classical shift ciphers with custom shift lengths.
- Mixed Alphabet: Key-based shift mechanisms mapping the standard alphabet.
- Simple Substitution: Create completely custom scrambled mappings.
- Baconian Cipher: Francis Bacon's steganographic, binary-like cipher (supports both classic 24-letter and modern 26-letter alphabets).
- Polybius Square: The classical ancient Greek fractionating cipher (coordinates).
Polyalphabetic Ciphers
- Alberti Cipher: The first polyalphabetic cipher! Supports both standard English 26-character modern modes AND the historically accurate 1467 Latin 24/24 Character Disks implementation seamlessly!
- Trithemius Cipher: Johannes Trithemius's tabula recta system.
- Vigenère Cipher: The famous, unbroken mathematical improvement using table offsets.
- Beaufort Cipher: A variant of Vigenère using a reversed tabula recta mechanism.
- Autokey Cipher: An extension where the plaintext itself becomes part of the key.
Quick Start
The API is simple: initialize your chosen cipher, then use .cipher() to encrypt and .decipher() to decrypt text.
Monoalphabetic Examples
from retro_ciphers.mono import Caesar, Atbash, Baconian
# Caesar Cipher
caesar = Caesar() # Default shift of 3
encrypted = caesar.cipher("Hello World!")
# >>> "Khoor Zruog!"
# Atbash Cipher
atbash = Atbash()
print(atbash.cipher("Classical Cryptography"))
# >>> "Xozhhzxzo Xibkgltizksb"
# Baconian Cipher
bacon = Baconian(modern_implementation=True)
print(bacon.cipher("Hide"))
# >>> "AABBBABAAAAABABAABAA"
Polyalphabetic Examples
from retro_ciphers.poly import Vigenere, Alberti
# Vigenère Cipher
vigenere = Vigenere("LEMON")
encrypted = vigenere.cipher("ATTACK AT DAWN")
print(encrypted)
# >>> "LXFOPV EF RNHR"
decrypted = vigenere.decipher(encrypted)
print(decrypted)
# >>> "ATTACK AT DAWN"
# Alberti Cipher (Historical 1467 Mode)
# Uses the original Latin outer ("ABCDEFGILMNOPQRSTVXZ1234") and inner mappings
alberti = Alberti(key="a", modern_implementation=False)
secret = alberti.cipher("ABCDEFGHI")
print(secret)
Extra arguments
omit_non_alpha: Available in thecipher()methods across ciphers (such asAlbertiandAutokey). Accepts a boolean value (default:False). IfTrue, it removes special symbols such as punctuation from the ciphertext. IfFalse, it safely passes them through so they are kept intact.Alberti(key, frequency=50, modern_implementation=True):modern_implementation: By default (True), the cipher uses the standard modern English A-Z alphabet. If you passFalse, it enforces the historically accurate 1467 24-character Latin disks.frequency: By default (50), the Alberti cipher automatically changes its mapping disk (indicating via a new outer key) every 50 characters to improve security against cryptanalysis. You can increase or decrease this rate.
Baconian(modern_implementation=True): By default (True), uses the full 26-letter alphabet. IfFalse, it mimics Bacon's original 24-letter alphabet where 'I' & 'J' and 'U' & 'V' map to the same sequences.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for retro-ciphers 1.0.1
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 | Actions |
|---|---|---|---|---|
| retro_ciphers-1.0.1.tar.gz | 16.4 kB | Without provenance | Details for retro_ciphers-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| retro_ciphers-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for retro_ciphers-1.0.1-py3-none-any.whl |
Total release size: 30.2 kB
Release files / retro_ciphers-1.0.1.tar.gz
| Download URL | retro_ciphers-1.0.1.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe45b8f60d306b210de613ffbb3e4fb738d804bd90e5d5f7bdd2c6e8f734c500
|
|
BLAKE2b-256 checksum How to use checksums |
406c49048c5fe268d84a36d33b1d65cd16acaa1356e732f66975c5ebf3eab268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / retro_ciphers-1.0.1-py3-none-any.whl
| Download URL | retro_ciphers-1.0.1-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5b92f2b1d265fe0deea6eef33ac66c3a9446a9bc56dce0662df39fcd2154341
|
|
BLAKE2b-256 checksum How to use checksums |
2cac048d94452d4ac4aeda17d755249b600237a2c021fdbfbd05378f861235e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for retro-ciphers 1.0.1
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.