MCPcopy Create free account
hub / github.com/ActiveState/code / modInverse

Function modInverse

recipes/Python/572196_RSA/recipe-572196.py:100–104  ·  view source on GitHub ↗
(e,n)

Source from the content-addressed store, hash-verified

98 return a
99
100def modInverse(e,n):
101 # d such that de = 1 (mod n)
102 # e must be coprime to n
103 # this is assumed to be true
104 return egcd(e,n)[0]%n
105
106def totient(p,q):
107 # Calculates the totient of pq

Callers 1

passwordToKeyFunction · 0.85

Calls 1

egcdFunction · 0.70

Tested by

no test coverage detected