Deffee . The Herman algorithm is an algorithm for exchanging keys in the case of unsecured communication lines, which is applied to the TLS protocol
let's start with the process of generating the key, and we have a calculation called a "op mod,"
For example:mod 17 = 10, which is the calculation of the remainder.
now there are two of them . A and B, we use a calculation if we choose
3 ^ x mod 17,a and B generate a random integer, the integer is x, for example A is 2,b 3, then a uses 2 to calculate:
3^2 MoD 17 = 9①
b Calculated using 3:
3^3 Mode 17 = 10②
then A sends 9 to B,b to send 10 to a. Of course here's 9 and 10 are can be seen by anyone.
A after receiving 10 of B, do this calculation:
10^2 MoD 17 = 15③
B after receiving the 9 of a, do such calculations:
9^3 MoD 17 = 15④
This allows 15 to be used as a cryptographic key for two-person communication.
Suddenly it's a little bit out of the blue Why such calculations can calculate the same number 15?
The nature of the MoD operation is as follows:
Like a normal operation, he is exchangeable, associative, assignable, and can be expressed as
(a+b) MoD n= ((a mod n) + (b mod n)) mod n
(a?b) MoD n= ((a mod n)? ( b mod n) mod n
(AXB) MoD n= ((a mod n) x (b mod n)) mod n
(Ax (b+c)) mod n= (((AXB) mod n) + ((AXC) mod n)) mod n
A: The 10 used in the calculation of ③ is calculated by ②, which is:
(3^3 mode) ^2 MoD 17 = 15⑤
B: The calculation of the ④ is done by the use of 9 is calculated by the ①, that is:
(3^2 MoD) ^3 mod 17 = 15⑥
then the next step is to prove why ⑤ and ⑥ are equal.
(3^3 mode) ^2 mod = = (3^2 MoD) ^3 mod 17
in fact, it only uses the third of the above MoD's computational properties.
calculate ⑤ equals the following decomposition
= ((3 * 3 * 3) mod +) ^2 mod 17
= (((3 MoD) * (3 MoD) * (3 mod)) mod ^2 mod 17
= (((((3 MoD) * (3 MoD) * (3 MoD)) * ((((3 MoD) * (3 MoD) * (3 MoD) mod)) mod 17
= (3 MoD) * (3 MoD) * (3 MoD) * (3 MoD) * (3 MoD) * (3 mod)) mod 17
= (3 MoD) ^6 mod 17
The same result can be obtained by ⑥ decomposition .
= (3 MoD) ^6 mod 17
⑤⑥ are equally well-proven.
in this communication process, you can see A and B generate a random number 2 and 3, as long as 2 and 3 do not leak, then other people even know 3 mod 17, 9, 10 This information will not be 15 of this result.
This article turns from: 49468187
Deffee. Herman (Diffie–hellman) key exchange algorithm