# 密碼體制

## 對稱密匙

• 組密碼法（block cipher）－呢種密碼法會對固定長度嘅位元做加密同解密；即係例如每 2 位元嘅數據做一組，段演算法會對每組分別做加密，如果手上淨係得其中一個位元嘅數據（另外嗰個位元仲未傳到過嚟），部機就會企咗喺度乜嘢都唔做[2]；例子可以睇吓數據加密標準（Data Encryption Standard，DES）同進階加密標準（Advanced Encryption Standard，AES）[3]
• 流密碼法（stream cipher）－呢種密碼法會對段密文嘅每個位元獨立噉做加密同解密；即係每次收到一個位元就會即場做加密或者解密，就算收唔到下一個位元嘅數據都唔會企喺度唔郁，頂櫳係將段唔完整嘅密文或者解密輸出傳俾個用家[4]

## 公開密匙

1. 用家一定要能夠輕易噉計得出邊對密匙（加密匙 ${\displaystyle e}$解密匙 ${\displaystyle d}$）係相配嘅。
2. ${\displaystyle T}$運算上要簡單，即係用電腦行起上嚟唔使嘥好多系統資源
3. 最重要點：就算一個嘗試破解密碼嘅人就算清楚知道咗 ${\displaystyle T}$、任何數量嘅對應明文密文、以及係兩條密匙（${\displaystyle e}$${\displaystyle d}$）當中其中一條，淨低冇俾佢攞到嗰條密匙依然係喺運算上極難搵得出嚟嘅（例如想像條密匙用電腦計要計成 100 年先計到出嚟；可以睇運算複雜度[7]）。
4. ${\displaystyle x}$信息${\displaystyle k}$ 係密匙，${\displaystyle y={T_{k}}(x)}$，就算知道咗 ${\displaystyle y}$${\displaystyle x}$ 都要係難以搵到出嚟嘅。

## 註釋

1. 廿世紀初嘅組織用「淨係俾高層管理人員攞密匙」嘅做法嚟做折衷，不過喺實際應用上都係成日會撞到問題。

## 攷

1. Diffie, Whitfield; Hellman, Martin (November 1976). "New Directions in Cryptography" (PDF). IEEE Transactions on Information Theory. IT-22 (6): 644–654.
2. Knudsen, Lars R.; Robshaw, Matthew (2011). The Block Cipher Companion. Springer.
3. "FIPS PUB 197: The official Advanced Encryption Standard" (PDF). Computer Security Resource Center. National Institute of Standards and Technology.
4. Matt J. B. Robshaw (1995). Stream Ciphers Technical Report TR-701, version 2.0, RSA Laboratories.
5. Stallings, William (1990). Cryptography and Network Security: Principles and Practice. Prentice Hall. p. 165.
6. Diffie, Whitfield; Hellman, Martin (8 June 1976). "Multi-user cryptographic techniques". AFIPS Proceedings. 45: 109–112.
7. Cryptography: Theory and Practice, 3rd Edition. (Discrete Mathematics and Its Applications), (2005), by Douglas R. Stinson, Chapman and Hall/CRC.
8. Diffie, W. (1988). The first ten years of public-key cryptography. Proceedings of the IEEE, 76(5), 560-577.
9. Galbraith, S. D. (2012). Mathematics of public key cryptography. Cambridge University Press.