## 浅析Diffie–Hellman

2017-10-18 21:31  hyddd  阅读(5082)  评论(0编辑  收藏

### 四、DH算法描述

DH算法是相当简单、直观的，我直接把wikipedia的描述拿过来了：

• g、p是2个非私密数据
• a、b是私密数据
• A是根据：g、p、a算出来的非私密数据；B是根据：g、p、b算出来的非私密数据
• 把A从a传到b，根据求K公式，b得到秘钥k；a同理；

• p是一个大素数。p的位数决定了攻击者破解的难度
• g则不需要很大，并且在一般的实践中通常是2或者5。

### 五、安全与风险

• 爆破成本

How enormous a computation, you ask? Possibly a technical feat on a scale (relative to the state of computing at the time) not seen since the Enigma cryptanalysis during World War II. Even estimating the difficulty is tricky, due to the complexity of the algorithm involved, but our paper gives some conservative estimates. For the most common strength of Diffie-Hellman (1024 bits), it would cost a few hundred million dollars to build a machine, based on special purpose hardware, that would be able to crack one Diffie-Hellman prime every year.

`

• 泄密风险：私密数据a，b在生成K后将被丢弃，因此不存在a，b过长时间存在导致增加泄密风险。
• 中间人攻击：由于DH在传输p，g时并无身份验证，所以有机会被实施中间人攻击，替换双方传输时的数据。