Diffie-hellman Explain Wouah !

Diffie-hellman

 

Modulo

Given two numbers, a (the dividend) and n (the divisor), a modulo n (abbreviated as a mod n) is the remainder from the division of a by n. For instance, the expression “7 mod 5” would evaluate to 2 because 7 divided by 5 leaves a remainder of 2, while “10 mod 5” would evaluate to 0 because the division of 10 by 5 leaves a remainder of 0

 

1- Each Host A and B must agreed on a Prime Modulo and a Generator .

Lets say the Prime Modulo is 17 and the Generator is 3 :

then Host A and B select a Private number .

Lets say Host A choose 15 and Host B choose 13 ,

So host A calculate 3 to the power of 15 Mod 17 = 6
in detail :

3x3x3x3x3x3x3x3x3x3x3x3x3x3x3 = 14348907
So to do the modulo calculation  :      14348907 / 17 = 844053.xxxxxxxxxxxxx
Then you multiply 844053*17          = 14348901
Then you subtract 14348907 from 14348901 =  6

So host B calculate 3 to the power of 13 Mod 17 = 12
in detail :

3x3x3x3x3x3x3x3x3x3x3x3x3x =       1594323
So to do the modulo calculation  :      1594323 / 17 = 93783.xxxxxxxxxxxxx
Then you multiply 93783*17          =   1594311
Then you subtract 1594323 from 1594311      =  12

 

Then Host A send publicly his result to Host B and vice versa .

And now the TRICK !

Host A take Host B public result ( 12 ) and calculate it to the power of his private number ( 15 ) Mod 17 = 10

12x12x12x12x12x12x12x12x12x12x12x12x12x12x12x =15407021574586368
So to do the modulo calculation :
15407021574586368 / 17 =906295386740374.xxxxxxxxxxxxx
Then you multiply 844053*17          = 15407021574586358
Then you subtract 15407021574586368 from 15407021574586358 =  10

Host B take Host A public result ( 6 ) and calculate it to the power of his private number ( 13 ) Mod 17 = 10

6x6x6x6x6x6x6x6x6x6x6x6x6x  =13060694016
So to do the modulo calculation :
15407021574586368 / 17 =768276118.xxxxxxxxxxxxx
Then you multiply       768276118*17          = 13060694006
Then you subtract 13060694016 from 13060694006 =  10

And we have obtain the Share Secret ( 10 )

 

TALAAAAAAAAAAA !

 

 

Leave a Comment