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

Function passwordToPrimePair

recipes/Python/572196_RSA/recipe-572196.py:110–120  ·  view source on GitHub ↗
(pswd,bits=64)

Source from the content-addressed store, hash-verified

108 return (p-1)*(q-1)
109
110def passwordToPrimePair(pswd,bits=64):
111 assert 64<=bits
112 assert bits%4==0
113 length=bits//4
114 sep=len(pswd)//2
115 append="0"*(length-sep)
116 seed1=int(pswd[:sep]+append,16)
117 seed2=int(pswd[sep:]+append,16)
118 p=getPrime(bits,seed1)
119 q=getPrime(bits,seed2)
120 return p,q
121
122def passwordToKey(password,bits=64):
123 assert 64<=bits

Callers 1

passwordToKeyFunction · 0.85

Calls 1

getPrimeFunction · 0.85

Tested by

no test coverage detected