A Python library providing implementations of classical cipher algorithms
Project description
libciphers
A Python library providing implementations of classical cipher algorithms for cryptographic puzzles, CTF challenges, and educational purposes.
Install
pip install libciphers
Usage
from libciphers import caesar_encrypt, caesar_decrypt, vigenere_encrypt, vigenere_decrypt
# Caesar cipher
plaintext = "HELLO"
encrypted = caesar_encrypt(plaintext, 5)
decrypted = caesar_decrypt(encrypted, 5)
print(f"Caesar: {encrypted} -> {decrypted}") # MJQQT -> HELLO
# Vigenère cipher
encrypted = vigenere_encrypt("HELLO", "KEY")
decrypted = vigenere_decrypt(encrypted, "KEY")
print(f"Vigenère: {encrypted} -> {decrypted}") # RIJVQ -> HELLO
Supported Ciphers
Shift Ciphers
- Caesar (with brute force)
- ROT13, ROT-N
- Atbash
- Affine
Polyalphabetic Ciphers
- Vigenère
- Beaufort
- Variant Beaufort
- Autokey
- Running Key
- Porta
- Gronsfeld
- Quagmire variants
Transposition Ciphers
- Columnar
- Rail Fence
- Scytale
- Route
- Zigzag
Digraph Ciphers
- Playfair
- Four-Square
- Three-Square
Fractionated Ciphers
- Bifid
- Trifid
Other Ciphers
- Hill (2x2)
- Polybius Square
- Bazeries
- XOR
- Enigma (3-rotor)
Statistical Analysis
- Index of Coincidence
- Chi-squared
- N-gram scoring
- Kasiski examination
Development
git clone https://github.com/daedalus/libciphers.git
cd libciphers
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libciphers-0.1.0.tar.gz.
File metadata
- Download URL: libciphers-0.1.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a83b2f99c06bddbbeefce5f851e2c0f67a6afdf4c9e5668d129c84ef0fff6b3b
|
|
| MD5 |
d9ccd068d08dc3467ed602a23fc3c900
|
|
| BLAKE2b-256 |
75146a2d8db480d9f09f1adc507e335171a571c51c758645b706cf4094651b92
|
Provenance
The following attestation bundles were made for libciphers-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on daedalus/libciphers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libciphers-0.1.0.tar.gz -
Subject digest:
a83b2f99c06bddbbeefce5f851e2c0f67a6afdf4c9e5668d129c84ef0fff6b3b - Sigstore transparency entry: 1239500239
- Sigstore integration time:
-
Permalink:
daedalus/libciphers@52f191e9ccf06a1617b15b91aa468f537f5533b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@52f191e9ccf06a1617b15b91aa468f537f5533b4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file libciphers-0.1.0-py3-none-any.whl.
File metadata
- Download URL: libciphers-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f371fbd30ad62d740332cd29ef153c23460e70e616b4f5f9ba8738e063ae04b
|
|
| MD5 |
8d7306467b80314b6a13d5da528a9ee8
|
|
| BLAKE2b-256 |
b68eba350e7087513a10da5f82aac62ba3cd8a515be3c9a9a9c3e475495bb644
|
Provenance
The following attestation bundles were made for libciphers-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/libciphers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libciphers-0.1.0-py3-none-any.whl -
Subject digest:
0f371fbd30ad62d740332cd29ef153c23460e70e616b4f5f9ba8738e063ae04b - Sigstore transparency entry: 1239500240
- Sigstore integration time:
-
Permalink:
daedalus/libciphers@52f191e9ccf06a1617b15b91aa468f537f5533b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@52f191e9ccf06a1617b15b91aa468f537f5533b4 -
Trigger Event:
release
-
Statement type: