Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def gen_otps():
- template_phrase = 'Welcome, dear customer, the secret passphrase for today is: '
- OTP_1 = template_phrase + gen_passphrase(18)
- OTP_2 = template_phrase + gen_passphrase(18)
- otp_1 = bytes_to_long(OTP_1)
- otp_2 = bytes_to_long(OTP_2)
- nbit, e = 2048, 3
- privkey = RSA.generate(nbit, e = e)
- pubkey = privkey.publickey().exportKey()
- n = getattr(privkey.key, 'n')
- r = otp_2 - otp_1
- if r < 0:
- r = -r
- IMP = n - r**(e**2)
- if IMP > 0:
- c_1 = pow(otp_1, e, n)
- c_2 = pow(otp_2, e, n)
- return pubkey, OTP_1[-18:], OTP_2[-18:], c_1, c_2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement