ecb加密模式aes256_wifi加密模式哪个较好

(5) 2024-07-19 21:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说
ecb加密模式aes256_wifi加密模式哪个较好,希望能够帮助你!!!。

最近看了一些加密的工作模式

也查了一下先关的弱点

这里找到一篇ecb加密的弱点 

就暂时记录下来吧 

英文挺简单的 也没来的及翻译 

最近导师逼毕设跟什么一样 哎~~转发一下吧~免得忘记了

This is nothing new, but I just wanted to document it on my blog. Block ciphers encrypt data in blocks of bits. These blocks are generally 64 or 128 bits long. In the ECB (or Electronic Code Book) mode, each block is encrypted independently of the other blocks. As a result if two blocks are same, the same cipher text results. This enables the attacker to figure out all instances of a plaintext if that plaintext-cipher text pair is known and the cipher text is repeating. An attack based on the frequency analysis of the blocks is also possible. Frequently repeating cipher text blocks mean frequently repeating plain text blocks.

I will show the effects of another simple attack. In this case consider that the plain text is "Give Jo one two one two dollars". Note that I have purposely divided the message into blocks of 8 characters (or 64 bits in ASCII). "Give Jo " is the first block, "one two " is the next and so on.

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第1张

Now I will use the DESCryptoServiceProvider class to encrypt this plaintext using ECB mode. The code used to encrypt is available here. The only difference is that I have changed the mode to ECB, and the block size to 64 bits for this demo to work.

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第2张

After encrypting the plain text, the cipher text received is:-

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第3张

First of all note the repeated block because of ECB. "one two one two" (from the plain text) consists of two blocks of 64 bits each. These blocks give identical cipher text blocks because of ECB.

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第4张

Now consider if an attacker removes one of these blocks. This is the cipher text after removing one of the repeating blocks.

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第5张

If I decrypt this cipher text, using the same code (and key) I get:-

ecb加密模式aes256_wifi加密模式哪个较好_https://bianchenghao6.com/blog__第6张

Notice that the decryption was possible and successful, but the plain text is now different from the original plain text. Jo now gets lot less dollars 😉

Ofcourse these are the reasons why ECB mode is not preferred.

今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

上一篇

已是最后文章

下一篇

已是最新文章

发表回复