Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modulus = 71521286555472299312252291246589709247849481750774732993492805730954699131789
- pubExp = 65537
- p = 261857794043121448213410325750790838383
- q = 273130256889334854338089243490350662083
- phi = (p - 1)*(q - 1)
- def egcd(a, b):
- if a == 0:
- return (b, 0, 1)
- else:
- g, y, x = egcd(b % a, a)
- return (g, x - (b // a) * y, y)
- def modinv(a, m):
- gcd, x, y = egcd(a, m)
- if gcd != 1:
- return None
- else:
- return x % m
- def main():
- privExp = modinv(pubExp, phi)
- e1 = modinv(pubExp, (p-1))
- e2 = modinv(pubExp, (q-1))
- coeff = modinv(q, p)
- print("modulus = {0}\npubExp = {1}\nprivExp = {2}\np = {3}\nq = {4}\ne1 = {5}\ne2 = {6}\ncoeff = {7}".format(modulus, pubExp, privExp, p, q, e1, e2, coeff))
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement