Created
July 10, 2017 19:43
-
-
Save back-seat-driver/159c750c8591ba55ba2a2c6e76e1c05d to your computer and use it in GitHub Desktop.
RSA Tinker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from Primes_Under_1_000_000 import prime_list | |
#from random import randint | |
##from rsa_list import rsa | |
## | |
##from UNIQUE_VARIABLES import U_V | |
def gcd(x,y): | |
while y!=0: | |
(x,y)=(y,x%y) | |
return(x) | |
def rsa_return(p,q): | |
n=p*q | |
y=(p-1)*(q-1) | |
to_return=[] | |
for e in range(2,y+1): | |
if gcd(e,y)==1: | |
to_return.append(e) | |
return(to_return) | |
def count_check(p,q): | |
n=p*q | |
e_values = rsa_return(p,q) | |
to_return=[] | |
for i in range(len(e_values)): | |
c=0 | |
for x in range(0,n): | |
if (x**e_values[i])%n==x: | |
c+=1 | |
to_return.append(c) | |
return(to_return) | |
y = rsa_return(19,37) | |
x = count_check(19,37) | |
p=19 | |
q=37 | |
#### | |
####POWER CODE | |
to_print=[] | |
for i in range(len(y)): | |
#Formal thanks to crypto stack! | |
to_print.append((1+gcd(y[i]-1,p-1))*(1+gcd(y[i]-1,q-1))) | |
if x==to_print: | |
print(True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment