This python library gathers all the cryptographic attacks that I present on my website vozec.fr Most of the scripts are taken from my articles, so it is advisable to read them to better understand how they work!
git clone https://github.com/Vozec/Cryptolib.git
cd Cryptolib
nano first_test.py
... enjoy !
You can retrieve test for all attacks in the examples folder.
The file test.py
runs all tests in this folder.
-
Create a RSA-Object with secure parameters
sys = rsa_init()
-
Create a RSA-Object with custom parameters
sys = rsa_init( e=65537, n=... )
-
Show info on known variables
sys.info()
output:
--- Status --- E: known P: unknown Q: unknown N: known D: unknown PHI: unknown --------------
-
Encrypt Message: (e,n) have to be set
c = sys.encrypt(b'Hello Vozec')
-
Decrypt Message: (e,n,d) have to be set
m = sys.decrypt(c)
-
Remove a value:
sys.pop('p')
-
Add a value:
sys.add('n',7617...7187)
-
Get Public Key (.pub)
sys.public_key()
-
Get Private Key (.pem)
sys.private_key()
-
FactorDb Factorization
sys.factordb() m = sys.decrypt(c)
-
Fermat Factorization
sys.fermat() m = sys.decrypt(c)
-
Wiener Factorization
sys.wiener() m = sys.decrypt(c)
-
Common Prime Factorization
sys.common_prime() m = sys.decrypt(c)
-
Small m decoder
m = sys.small_m()
-
Common Modulus decoder
m = sys.common_modulus()
-
Hastad Broadcast attack
m = sys.hastad()
-
MultiPrimes decoder
primes = [..,..,..] sys.multi_primes() m = sys.decrypt(c)
-
Franklin Reiter attack
sys.add('c',c1) sys.add('c',c2) m2 = sys.franklin_reiter(a=a,b=b) #m2 = a*m1+b