# Revision history [back]

### Three-Pass Protocoll

I am currently trying to make an example for the three pass protocoll. 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

(The '//' in the code are '#')

 2 No.2 Revision tmonteil 25328 ●29 ●180 ●472 http://wiki.sagemath.o...

### Three-Pass ProtocollProtocol

I am currently trying to make an example for the three pass protocoll. 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

#Prime p = 8885569519.
//Let 8885569519.
#Let a = 7 and b = 17.
//Alice 17.
#Alice knows K = 263785119.263785119.

//Over #Over the Ring mod p-1 p-1
R = IntegerModRing(8885569518) IntegerModRing(8885569518)
K = 263785120 263785120
a = 11 11
b = 1717

//Alice #Alice calculates K^a: K^a:
Ka = R(K)^aR(K)^a

//Bob #Bob calculates (K^a)^b: (K^a)^b:
Kab = R(Ka)^bR(Ka)^b

//Alice #Alice recives Kab and calculates((K^a)^b)^a^(-1).
//first a^(-1) calculates((K^a)^b)^a^(-1).
#first a^(-1)
y = 1/R(a)
//then 1/R(a)
#then y*a % p-1 = 1 (p-1 = 8885569518) 8885569518)
Kaby = R(Kab)^yR(Kab)^y

//Kaby #Kaby should be the same as K^b: K^b:
Kb = R(K)^bR(K)^b
#but it isn't
//but it isn't#The inverse of b:
z = 1/R(b)
KK = R(Kaby)^z


//The inverse of b:

z = 1/R(b)

KK = R(Kaby)^z

K^a^b^a^(-1)
K^a^b^a^(-1) should be the same as K^b, K^b, but it doesn't work out.

out. Does someone see my mistake?

Thank you and best,

best, Luca

(The '//' in the code are '#')