Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 0 years ago

Max Alekseyev gravatar image

3e1(mod5) means that e=5k+2 for some k. Then e having n=71 bits means e[2n1,2n1], which translates into k[(2n12)/5,(2n3)/5]. Hence, it's enough to generate such a random integer k, and then compute e out of it:

n = 71
L = ceil((2^(n-1)-2)/5)
U = (2^n-3)//5
import random
e = random.randint(L,U)*5 + 2