Cet article, rédigé rapidement, rassemble quelques outils concernant les implémentations de RSA. Il est plutôt orienté Python. Avec tout ca, pas de souci pour réussir l'épreuve de Nico34 du site Zenk Security!
factorisation en ligne
Ce site permet de calculer des factorisations en ligne;
http://icosaweb.ac-reunion.fr/OutilsCalculEnLigne/FormulairesWIMS/Docs/factoriser.htm
calculs modulo
Ce site fournit un applet java de calculs modulo:
http://www.mtholyoke.edu/~mpeterso/Applets/CalculatorApplet.html
inversemodulo.py
Voici un script pour calculer l'inverse modulo:
script RSA
un script qui fonctionne bien:
https://docs.google.com/open?id=0B-dlin-yvm82YjgyZmU3ZTAtZTIwYy00YWVhLWI3YTEtOWI3ZGExZGQ4Zjcz
l'entrée est un fichier codé en base 64.
étrangeté
une implémentation très compacte de RSA
source: http://www.amk.ca/python/writing/crypto-curiosa
Je cite:
modules crypto python
comparaison de modules cryptographiques en python
Nous vous renvoyons à ce PDF d'une page qui fait une synthèse des différentes implémentations cryptographiques en python
http://mikeivanov.com/pc/python-crypto.pdf
pycrypto
La librairie python-crypto est fournie par défaut avec Python sous Ubuntu 10.10.
Le site source:
http://www.dlitz.net/software/pycrypto/
... et la documentation en ligne:
http://www.dlitz.net/software/pycrypto/apidoc/
m2crypto
sous ubuntu 10.10:
module python RSA
Cette librairie est fournie par nos amis du plat pays:
http://pypi.python.org/pypi/rsa
factorisation en ligne
Ce site permet de calculer des factorisations en ligne;
http://icosaweb.ac-reunion.fr/OutilsCalculEnLigne/FormulairesWIMS/Docs/factoriser.htm
calculs modulo
Ce site fournit un applet java de calculs modulo:
http://www.mtholyoke.edu/~mpeterso/Applets/CalculatorApplet.html
inversemodulo.py
Voici un script pour calculer l'inverse modulo:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# usage:
# pour calculer l'inverse de 11 modulo 63:
# $ python inversemodulo.py 11 63
def bezout(a, b):
''' Calcule (u, v, p) tels que a*u + b*v = p et p = pgcd(a, b) '''
if a == 0 and b == 0: return (0, 0, 0)
if b == 0: return (a/abs(a), 0, abs(a))
(u, v, p) = bezout(b, a%b)
return (v, (u - v*(a/b)), p)
def inv_modulo(x, m):
''' Calcule y dans [[0, m-1]] tel que x*y % abs(m) = 1 '''
(u, _, p) = bezout(x, m)
if p == 1: return u%abs(m)
else: raise Exception("%s et %s ne sont pas premiers entre eux" % (x, m))
if __name__ == "__main__":
from sys import argv
try :
x, m = int(argv[1]), int(argv[2])
print "L'inverse de %s modulo %s est : %s" % (x,m,inv_modulo(x,m))
except Exception, m:
print m
print "Merci de choisir un autre couple de valeurs"
script RSA
un script qui fonctionne bien:
https://docs.google.com/open?id=0B-dlin-yvm82YjgyZmU3ZTAtZTIwYy00YWVhLWI3YTEtOWI3ZGExZGQ4Zjcz
l'entrée est un fichier codé en base 64.
étrangeté
une implémentation très compacte de RSA
source: http://www.amk.ca/python/writing/crypto-curiosa
Je cite:
As an example: Let us assume the modulus is 6819722537 (in hex, 0x1967cb529), the encryption exponent is 65537 (hex 0x10001), and the decryption exponent is 2889233921 (hex 0xac363601). Then, after converting the numbers to hex, we can encrypt and then decrypt by the following commands:
echo 'Top secret message.' | rsa.py 10001 1967cb529 >ciphertext
cat ciphertext | rsa.py -d ac363601 1967cb529
#!/usr/local/bin/python
from sys import*;from string import*;a=argv;[s,p,q]=filter(lambda x:x[:1]!='-',a);d='-d'in a;e,n=atol(p,16),atol(q,16);l=(len(q)+1)/2;o,inb=l-d,l-1+d
while s:s=stdin.read(inb);s and map(stdout.write,map(lambda i,b=pow(reduce(lambda x,y:(x<<8L)+y,map(ord,s)),e,n):chr(b>>8*i&255),range(o-1,-1,-1)))
modules crypto python
comparaison de modules cryptographiques en python
Nous vous renvoyons à ce PDF d'une page qui fait une synthèse des différentes implémentations cryptographiques en python
http://mikeivanov.com/pc/python-crypto.pdf
pycrypto
La librairie python-crypto est fournie par défaut avec Python sous Ubuntu 10.10.
# apt-get install python-crypto
Le site source:
http://www.dlitz.net/software/pycrypto/
... et la documentation en ligne:
http://www.dlitz.net/software/pycrypto/apidoc/
m2crypto
sous ubuntu 10.10:
# apt-get install python-m2crypto
module python RSA
Cette librairie est fournie par nos amis du plat pays:
http://pypi.python.org/pypi/rsa
Aucun commentaire:
Enregistrer un commentaire