ranisalt

Python RSA Cracker

Aug 1st, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. def primo(n):
  2.     # Eu assumo que todos os valores são ímpares (pela definição do for), assim não preciso testar se é múltiplo de 2.
  3.     for i in xrange(3, n ** .5 + 1, 2): # Se n = i * j, se i > sqrt(n), então j < sqrt(n) e esse teste já foi feito.
  4.         if n % i == 0: return False
  5.     return True
  6.  
  7. num = 67590067757306080
  8. for i in xrange(2 ** 27 + 1, 2 ** 28, 2):
  9.     if num % (i - 1) == 0:
  10.         if primo(i): # p = i
  11.             if primo(num / (i - 1) + 1): # Se (p - 1)(q - 1) = num, então q = (num / (i - 1)) + 1.
  12.                 print "%d %d" % (i, num / (i - 1) + 1);
  13.                 break
Add Comment
Please, Sign In to add comment