Biblioteca educativa de criptografia: teoria de numeros, cifrados clasicos y ataques
Project description
mi_crypto_lib 🔐
Biblioteca educativa de criptografía desarrollada en Python puro (sin dependencias externas).
Estructura
mi_crypto_lib/
├── teoria_numeros/ # Herramientas de teoría de números
│ ├── phi.py # Función indicatriz de Euler φ(n)
│ ├── crr.py # Conjunto Reducido de Residuos
│ └── inversos.py # Inversos multiplicativos (Euler, Euclides extendido)
│
├── cifrados_clasicos/ # Cifrados clásicos
│ ├── vigenere_autoclave.py # Vigenère Autoclave (texto plano / criptograma)
│ └── hill.py # Cifrado Hill (matricial)
│
├── ataques/ # Criptoanálisis
│ └── gauss_jordan.py # Ataque al cifrado Hill con Gauss-Jordan
│
├── ejemplos/ # Demostraciones
│ └── rsa_demo.py # Demo completa de RSA con n = p·q
│
├── setup.py
├── README.md
└── LICENSE
Instalación
# Desde el directorio raíz del proyecto:
pip install -e .
Uso rápido
Teoría de números
from mi_crypto_lib.teoria_numeros import phi, crr, inverso_euler
# Función φ de Euler
print(phi(36)) # 12
# Conjunto Reducido de Residuos
print(crr(10)) # [1, 3, 7, 9]
# Inverso multiplicativo
print(inverso_euler(3, 26)) # 9 → 3 × 9 ≡ 1 (mod 26)
Cifrado Vigenère Autoclave
from mi_crypto_lib.cifrados_clasicos import cifrar_vigenere_autoclave, descifrar_vigenere_autoclave
cifrado = cifrar_vigenere_autoclave("ATACARALAMANECER", "SOL")
print(cifrado)
texto = descifrar_vigenere_autoclave(cifrado, "SOL")
print(texto) # ATACARALAMANECER
Cifrado Hill
from mi_crypto_lib.cifrados_clasicos import cifrar_hill, descifrar_hill
K = [[6, 24, 1], [13, 16, 10], [20, 17, 15]]
cifrado = cifrar_hill("ACT", K)
print(cifrado) # POH
texto = descifrar_hill(cifrado, K)
print(texto) # ACT
Ataque Gauss-Jordan al cifrado Hill
from mi_crypto_lib.ataques import hill_ataque
clave = hill_ataque("HELP", "XMCK", tamano_bloque=2)
print(clave)
Demostración RSA
from mi_crypto_lib.ejemplos.rsa_demo import demo_completa
demo_completa(p=61, q=53)
Requisitos
- Python ≥ 3.8
- Sin dependencias externas (solo librería estándar)
Licencia
MIT License — ver LICENSE
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
mi_crypto_lib-1.0.0.tar.gz
(13.5 kB
view details)
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 mi_crypto_lib-1.0.0.tar.gz.
File metadata
- Download URL: mi_crypto_lib-1.0.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0efb2187c448dda28893e25cc2e113fb86e4985260f41fcfd06d172718baf56c
|
|
| MD5 |
ffbb31f5af88248c0976dab7d8a465fb
|
|
| BLAKE2b-256 |
8474edf4cc47790935dd29a5f77d49d1f2166bc1e57168ddb26e88380f9c69e7
|
File details
Details for the file mi_crypto_lib-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mi_crypto_lib-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
827701c41f3d5199017e08560da515b078008504b640ccafd26f5e95224e41df
|
|
| MD5 |
ce418e9ebc6f1213d032769242061e98
|
|
| BLAKE2b-256 |
e1472924d68dcb605dc6a083643cf08e8ee8938f7290863c35f74786533f0df0
|