Metadata-Version: 2.4
Name: libciphers
Version: 0.1.0
Summary: A Python library providing implementations of classical cipher algorithms
Project-URL: Homepage, https://github.com/daedalus/libciphers
Project-URL: Repository, https://github.com/daedalus/libciphers
Project-URL: Issues, https://github.com/daedalus/libciphers/issues
Author-email: Dario Clavijo <clavijodario@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.11
Provides-Extra: all
Requires-Dist: hatch; extra == 'all'
Requires-Dist: hypothesis; extra == 'all'
Requires-Dist: mypy; extra == 'all'
Requires-Dist: pip-api; extra == 'all'
Requires-Dist: pytest; extra == 'all'
Requires-Dist: pytest-asyncio; extra == 'all'
Requires-Dist: pytest-cov; extra == 'all'
Requires-Dist: pytest-mock; extra == 'all'
Requires-Dist: ruff; extra == 'all'
Provides-Extra: dev
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pip-api; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: lint
Requires-Dist: mypy; extra == 'lint'
Requires-Dist: ruff; extra == 'lint'
Provides-Extra: test
Requires-Dist: hypothesis; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-mock; extra == 'test'
Description-Content-Type: text/markdown

# libciphers

A Python library providing implementations of classical cipher algorithms for cryptographic puzzles, CTF challenges, and educational purposes.

[![PyPI](https://img.shields.io/pypi/v/libciphers.svg)](https://pypi.org/project/libciphers/)
[![Python](https://img.shields.io/pypi/pyversions/libciphers.svg)](https://pypi.org/project/libciphers/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

## Install

```bash
pip install libciphers
```

## Usage

```python
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

```bash
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/
```
