Skip to main content

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.

PyPI Python Ruff

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libciphers-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

libciphers-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

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

Hashes for libciphers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a83b2f99c06bddbbeefce5f851e2c0f67a6afdf4c9e5668d129c84ef0fff6b3b
MD5 d9ccd068d08dc3467ed602a23fc3c900
BLAKE2b-256 75146a2d8db480d9f09f1adc507e335171a571c51c758645b706cf4094651b92

See more details on using hashes here.

Provenance

The following attestation bundles were made for libciphers-0.1.0.tar.gz:

Publisher: pypi-publish.yml on daedalus/libciphers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for libciphers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f371fbd30ad62d740332cd29ef153c23460e70e616b4f5f9ba8738e063ae04b
MD5 8d7306467b80314b6a13d5da528a9ee8
BLAKE2b-256 b68eba350e7087513a10da5f82aac62ba3cd8a515be3c9a9a9c3e475495bb644

See more details on using hashes here.

Provenance

The following attestation bundles were made for libciphers-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on daedalus/libciphers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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