15

I have a set of logarithm which are L1, L2 and L3 which I have retrieved it from the paper An Ultra-secure Router-to-router Spontaneous Key Exchange System (2015), here. The aim of this paper is to securely share key between Alice and Bob. For example, Alice sent K = 46 to Bob. Bob received the key from Alice. Key can be represented as:

enter image description here

The key needs to be shared using three stage process. L1: Alice to Bob. L2: Bob to Alice. L3: Alice to Bob.The equations are:

enter image description here

enter image description here

enter image description here

Bob can evaluate the key using: enter image description here

This is the result for the equations: enter image description here

Given the value of alpha = 5, x = 15 and p = 97. After I implement it in Python, I got the wrong result, which is not same in the result in the table:

a=5
x=15
p=97
i1=0.958478
i2=4.238835

L1=a**(x+i1)%p
L2=a**(x+i1+i2)%p
L3=a**(x+i2)%p
K=L3*(a**(-i2))

print ("L1",L1)
print ("L2",L2)
print ("L3",L3)
print ("K",K)

Which produce this result:

L1 55.596893310546875
L2 2.15625
L3 68.87890625
K 0.07503566293789979

Another problem is I tried to calculate it manually but the result is still not same with the result in the table. I hope that anyone may help me. Thank you.

Nelewout
  • 6,281
  • 3
  • 29
  • 39
Afir
  • 483
  • 3
  • 15
  • 1
    so I guess the paper was wrong? – Nic Wanavit Jul 21 '19 at 13:25
  • Typically modular arithmetic is with integers, so I'm puzzled looking at your floats. Note, that for integers `pow(basis, exponent, modulus)` is a ready-made performant implementation. – guidot Jul 30 '19 at 14:14

3 Answers3

1

A math-savvy friend of mine helped me figure out what went wrong. The answers that you got are correct. The issue is with the values that authors have given for i1 and i2.

A single additional decimal number completely changes the result of the mod p operation in this part:

L1 = a**(x+i1)%p In the case of i1 being equal to 0.958478, the output is: 55.596893310546875

Now, if you add even a single additional 1 to the end of the value for i1, resulting in an i1 of 0.9584781, the output of the same equation becomes a completely different number: 37.163330078125

If you compare the algorithm to determine that K = L3*a**(-i2), using the given i2 of 4.238835, you will also quickly find that the result is not equal to 46. The initial value of K, as calculated with the algorithm (a**x)%p, was 46, so that's what the above algorithm should have evaluated to. Instead, the result of this equation with the given values is 0.05102662974.

My friend came up with a theory based on the fact that the authors said they were using Matlab. Matlab has a feature that allows the user to limit to what decimal place numbers are displayed. The decimal numbers still behave according to their actual value, but their representation on screen is truncated to the specified decimal place. For most operations, this is totally fine and would have a negligible impact on the results of the calculations. However, when performing a modulus operation, a single 1, even in the least-significant decimal place of the number, can alter the entire number.

Thus we conject that the actual i1 and i2 values were truncated by their display settings in Matlab. This wouldn't alter the algorithm's truthiness and also wouldn't prevent it from evaluating to the correct value of variable K at the end of the operation. All the results of having used the full decimal values of i1 and i2 would have been displayed. However, it would also make the entire process impossible to reproduce for someone using the same numbers that Matlab had displayed to our authors at the time of calculation.

0

The document you specified is a little blurry. The example given below covers non-fixed points.

You do not share gm,pm if you want(as a static definition or table).

The work you do is more important than the algorithm. Do not mixed the basic and improved terms.

am=5 #Secret key of A node
bm=9 #Secret key of B node
gm=15 #Shared Base Number
pm=97 #Shared Modulos

A = (gm^am)%p #Shared key from A
B = (gm^bm)%p #Shared key from B

Ka = (A^bm) %p #Calculate Key wit A node Answer
Kb = (B^am)%p  #Calculate Key wit B node Answer

print "Shared Key A:",A,"Shared Key B:",B
print "Node A key :",Ka,"Node B key :",Kb

NUMSA = [[i,(am**i)%p] for i in range(p) if i > 0]
NUMSB = [[i,(bm**i)%p] for i in range(p) if i > 0]


print NUMSA #ALL Numbers and means for A node
print NUMSB #ALL Numbers and means for B node

What did the poet want to say here? I don't like that kind of interpretation.

What do you understand?

I hope it helps.

dsgdfg
  • 1,492
  • 11
  • 18
0

ok i found the mistake:

  • (a^(x+i2) % p) * a^(-i2) != a^(x+i2 -i2) % p because of the modulo
  • also you do not need 4 way exchange if a,x, and p are known and if they are unknown, they can not send messages
user8426627
  • 903
  • 1
  • 9
  • 19