Metadata-Version: 2.4
Name: crypto-12
Version: 0.1.1
Summary: Educational cryptography and network security concepts in Python
License: MIT
Project-URL: Homepage, https://github.com/example/crypto-12
Project-URL: Repository, https://github.com/example/crypto-12
Keywords: cryptography,cipher,security,education,hash
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Education
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# crypto-12

A pure-Python educational package covering 21 cryptography and network security concepts.  
No external dependencies. Works with Python 3.8+.

---

## 📦 Package Structure

```
crypto-12/
│
├── crypto_12/
│   ├── __init__.py
│   ├── caesar_cipher.py
│   ├── monoalphabetic_cipher.py
│   ├── vigenere_cipher.py
│   ├── playfair_cipher.py
│   ├── hill_cipher.py
│   ├── rail_fence_cipher.py
│   ├── row_column_transposition.py
│   ├── rsa_demo.py
│   ├── diffie_hellman_demo.py
│   ├── sha1_hash.py
│   ├── md5_hash.py
│   ├── gcd_euclidean.py
│   ├── extended_euclidean.py
│   ├── multiplicative_inverse.py
│   ├── affine_cipher.py
│   ├── columnar_transposition.py
│   ├── simple_permutation.py
│   ├── otp_cipher.py
│   ├── frequency_analysis.py
│   ├── sql_injection_demo.py
│   └── nmap_scan_demo.py
│
├── pyproject.toml
└── README.md
```

---

## 🚀 Installation

### Option 1 — Install directly (editable/development mode)

```bash
pip install .
```

### Option 2 — Build a distributable wheel, then install

```bash
# Install build tool
pip install build

# Build the package
python -m build

# Install the built wheel
pip install dist/crypto_12-0.1.0-py3-none-any.whl
```

---

## 🔧 Usage

After installing, you can import and use any module:

```python
from crypto_12 import caesar_cipher

caesar_cipher.run()
```

Or call individual functions:

```python
from crypto_12.caesar_cipher import encrypt, decrypt

encrypted = encrypt("HELLO WORLD", 3)
decrypted = decrypt(encrypted, 3)
print(encrypted)  # KHOOR ZRUOG
print(decrypted)  # HELLO WORLD
```

---

## 📚 Module Reference

### Substitution Ciphers

| Module | Description |
|--------|-------------|
| `caesar_cipher` | Shift cipher — each letter shifted by a fixed amount |
| `monoalphabetic_cipher` | Arbitrary fixed substitution using a 26-letter key alphabet |
| `vigenere_cipher` | Polyalphabetic cipher using a repeating keyword |
| `playfair_cipher` | Digraph cipher using a 5×5 key matrix |
| `hill_cipher` | Linear algebra cipher using a 2×2 invertible matrix (mod 26) |
| `affine_cipher` | `C = (a*P + b) mod 26` with modular inverse for decryption |

### Transposition Ciphers

| Module | Description |
|--------|-------------|
| `rail_fence_cipher` | Zig-zag pattern writing across N rails |
| `row_column_transposition` | Write in rows, read columns sorted by key |
| `columnar_transposition` | Column reordering based on alphabetical key ranking |
| `simple_permutation` | Rearranges character positions within fixed-length blocks |

### Public Key / Key Exchange

| Module | Description |
|--------|-------------|
| `rsa_demo` | Simplified RSA: key generation, encrypt/decrypt with small primes |
| `diffie_hellman_demo` | DH key exchange: shared secret agreement over public channel |

### Hashing

| Module | Description |
|--------|-------------|
| `sha1_hash` | Pure-Python SHA-1 implementation (160-bit hash) |
| `md5_hash` | Pure-Python MD5 implementation (128-bit hash) |

### Number Theory / Math Utilities

| Module | Description |
|--------|-------------|
| `gcd_euclidean` | GCD with step-by-step Euclidean trace |
| `extended_euclidean` | Extended GCD returning Bezout coefficients |
| `multiplicative_inverse` | Modular inverse: `a * x ≡ 1 (mod m)` |

### Cryptanalysis

| Module | Description |
|--------|-------------|
| `frequency_analysis` | Letter frequency counter + Caesar shift guesser |
| `otp_cipher` | One-Time Pad simulation using XOR + random key |

### Security Awareness (Safe Demos)

| Module | Description |
|--------|-------------|
| `sql_injection_demo` | Explains SQL injection with safe/vulnerable query comparison |
| `nmap_scan_demo` | Nmap command reference; prints examples only, no real scanning |

---

## ▶️ Running Individual Modules Interactively

Each module has a `run()` function with interactive prompts:

```bash
python -c "from crypto_12 import vigenere_cipher; vigenere_cipher.run()"
python -c "from crypto_12 import rsa_demo; rsa_demo.run()"
python -c "from crypto_12 import frequency_analysis; frequency_analysis.run()"
```

---

## ⚠️ Disclaimer

- The SHA-1 and MD5 implementations are **educational** and should **not** be used for security-critical applications.  
- The SQL injection demo performs **no real database queries**.  
- The Nmap demo performs **no actual network scans**.  
- RSA and Diffie-Hellman use **small numbers** for clarity; real implementations require much larger primes.

---

## 📄 License

MIT License — free to use for learning and educational purposes.
