Three-Pass Protocol
I am currently trying to make an example for the three pass protocol. Maybe someone can tell me my mistake, because it doesn't work out. There is no error, but the numbers don't fit.
#Prime p = 8885569519.
#Let a = 7 and b = 17.
#Alice knows K = 263785119.
#Over the Ring mod p-1
R = IntegerModRing(8885569518)
K = 263785120
a = 11
b = 17
#Alice calculates K^a:
Ka = R(K)^a
#Bob calculates (K^a)^b:
Kab = R(Ka)^b
#Alice recives Kab and calculates((K^a)^b)^a^(-1).
#first a^(-1)
y = 1/R(a)
#then y*a % p-1 = 1 (p-1 = 8885569518)
Kaby = R(Kab)^y
#Kaby should be the same as K^b:
Kb = R(K)^b
#but it isn't
#The inverse of b:
z = 1/R(b)
KK = R(Kaby)^z
K^a^b^a^(-1)
should be the same as K^b
, but it doesn't work out. Does someone see my mistake?
Thank you and best, Luca