Diffe-Hellman 左手的ㄟ右手 2022-05-09 04:42 148阅读 0赞 # Diffe-Hellman密钥交换算法,主要是实现双方共享一个密钥 # -------------------- 我们假设用户A,B想要秘密共享密钥Key 具体过程如下: 1. A,B协商大质数N,及生成元g(注意:这里的协商不是线下,而是线上属不安全通信) 2. A取一个随机数K1,并计算C1=![\_\{g\}K1][g_K1] mod N 3. B取一个随机数K2,并计算C2=![\_\{g\}K2][g_K2] mod N 4. A 将C1发给B,B将C2发给A 5. A计算![\_\{C2\}K1][C2_K1] mod N =Key,B计算![\_\{C1\}K2][C1_K2] mod N =Key A,B双方实际完成的是Key=![^\{^\{g\}K1^\{K2\}\}][g_K1_K2] mod N = ![^\{^\{g\}K2^\{K1\}\}][g_K2_K1] mod N -------------------- 具体演示如下(点击进入全屏): ![演示][70] -------------------- [g_K1]: https://private.codecogs.com/gif.latex?_%7Bg%7DK1 [g_K2]: https://private.codecogs.com/gif.latex?_%7Bg%7DK2 [C2_K1]: https://private.codecogs.com/gif.latex?_%7BC2%7DK1 [C1_K2]: https://private.codecogs.com/gif.latex?_%7BC1%7DK2 [g_K1_K2]: https://private.codecogs.com/gif.latex?%5E%7B%5E%7Bg%7DK1%5E%7BK2%7D%7D [g_K2_K1]: https://private.codecogs.com/gif.latex?%5E%7B%5E%7Bg%7DK2%5E%7BK1%7D%7D [70]: /images/20220509/a320e75e9f534de2b64e8c05387fd8a1.png
还没有评论,来说两句吧...