博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

AES五种加密模式(CBC、ECB、CTR、OCF、CFB)

Posted on 2016-09-18 09:55  bw_0927  阅读(1768)  评论(0)    收藏  举报

http://www.cnblogs.com/starwolf/p/3365834.html

http://blog.poxiao.me/p/advanced-encryption-standard-and-block-cipher-mode/ 


Rijndael (pronounced Reindaal) is a block cipher, designed by Joan Daemen and Vincent Rijmen as a candidate algorithm for the AES.
The cipher has a variable block length and key length. The authors currently specify how to use keys with a length
of 128, 192, or 256 bits to encrypt blocks with al length of 128, 192 or 256 bits (all nine combinations of
key length and block length are possible). Both block length and key length can be extended very easily to
 multiples of 32 bits.
Rijndael can be implemented very efficiently on a wide range of processors and in hardware.

 

 

分组密码有五种工作体制:1.电码本模式(Electronic Codebook Book (ECB));2.密码分组链接模式(Cipher Block Chaining (CBC));3.计算器模式(Counter (CTR));4.密码反馈模式(Cipher FeedBack (CFB));5.输出反馈模式(Output FeedBack (OFB))。

以下逐一介绍一下:
1.电码本模式(Electronic Codebook Book (ECB)
    这种模式是将整个明文分成若干段相同的小段,然后对每一小段进行加密。
 

In ECB mode if the same block is encrypted twice with the same key, the resulting ciphertext blocks are the same.

 

2.密码分组链接模式(Cipher Block Chaining (CBC))

    这种模式是先将明文切分成若干小段,然后每一小段与初始块或者上一段的密文段进行异或运算后,再与密钥进行加密。

In CBC Mode a ciphertext block is obtained by first xoring the plaintext block with the previous ciphertext block, and encrypting the resulting value.

 

3.计算器模式(Counter (CTR))

        计算器模式不常见,在CTR模式中, 有一个自增的算子,这个算子用密钥加密之后的输出和明文异或的结果得到密文,相当于一次一密。这种加密方式简单快速,安全可靠,而且可以并行加密,但是在计算器不能维持很长的情况下,密钥只能使用一次。

 

4.密码反馈模式(Cipher FeedBack (CFB))

    这种模式较复杂。


In CFB mode a ciphertext block is obtained by encrypting the previous ciphertext block and xoring the resulting value with the plaintext.

 

5.输出反馈模式(Output FeedBack (OFB))

    这种模式较复杂。