ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 Nov 2013 17:14:14 +0100Three-Pass Protocolhttps://ask.sagemath.org/question/10701/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
Tue, 05 Nov 2013 17:46:17 +0100https://ask.sagemath.org/question/10701/three-pass-protocol/Answer by 00Luca00 for <p>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.</p>
<pre><code>#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
</code></pre>
<p><code>K^a^b^a^(-1)</code> should be the same as <code>K^b</code>, but it doesn't work out. Does someone see my mistake?</p>
<p>Thank you and best,
Luca</p>
https://ask.sagemath.org/question/10701/three-pass-protocol/?answer=15668#post-id-15668I found the problem. It was that if I calculated R(Ka^y) it simply should have been K, but it wasn't. So I tried
'Kaby = R(K^(a*b*y))'
and this way it works and is the same as Kb. And also
R(K^(a*y))=K.
So I didn't try your suggestion. But thanks a lot for the response!! :)Wed, 06 Nov 2013 17:14:14 +0100https://ask.sagemath.org/question/10701/three-pass-protocol/?answer=15668#post-id-15668Answer by John Palmieri for <p>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.</p>
<pre><code>#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
</code></pre>
<p><code>K^a^b^a^(-1)</code> should be the same as <code>K^b</code>, but it doesn't work out. Does someone see my mistake?</p>
<p>Thank you and best,
Luca</p>
https://ask.sagemath.org/question/10701/three-pass-protocol/?answer=15659#post-id-15659While your computations for `y` and `z` are correctly done (I think) in **Z**/(*p*-1), your computations with *K* need to be done in **Z**/(*p*) instead. So add another ring:
R = IntegerModRing(8885569518)
S = IntegerModRing(8885569519)
K = 263785120
a = 11
b = 17
Ka = S(K)^a
(etc.)
y = 1/R(a)
(etc.)
Tue, 05 Nov 2013 19:29:02 +0100https://ask.sagemath.org/question/10701/three-pass-protocol/?answer=15659#post-id-15659