AES及其密码模式 [英] AES and its cipher modes

查看:228
本文介绍了AES及其密码模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加密/解密AES,然后我尝试了CBC& ECB模式
我得到所有三个相同的加密输出!这是怎么回事?

这可能不是错的,但我只是不知道该怎么做。如果他们都产生相同的密码,有什么模式呢?是时间还是性能复杂?



您可以解释AES与其加密模式之间的区别吗?什么是默认密码模式?或者如果你可以给我任何参考,那么MSDN不够清楚



谢谢

解决方案

CBC和ECB模式是在加密大于一个块(AES中为128位)的数据时使用对称加密算法的方法。因此,如果要加密适合一个块的数据,则CBC和ECB模式将导致相同的密文(假设您在使用CBC模式时使用零IV)。如果您正在加密大小超过一个块的数据,或者您使用的IV不为空,并且您看到相同数据的CBC和ECB加密相同,则您的代码中出现了错误。



这在维基百科条目中解释得很好。



http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation


I was trying encryption/decryption with AES then I tried the CBC & ECB modes I got the same encrypted output from all three ! is this how it goes?
it's may not be wrong but I just don't know what to expect . and what's the point of having modes if they all produce the same cipher ? is it time or performance complexity ?

can you explain the difference between AES and its cipher modes ? what's the default cipher mode ? or if you can give me any references cuz MSDN is not clear enough

thank you

解决方案

CBC and ECB modes are ways to use symmetric encryption algorithms when you are encrypting data that is larger than one block (128 bits in AES). So, if you are encrypting data that fits into one block then CBC and ECB modes will result in the same ciphertext (assuming you are using a null IV when using CBC mode). If you are encrypting data greater in size than one block, or you are using an IV that is not null, and you are seeing CBC and ECB encryptions of the same data come out the same, you're doing something wrong in your code.

This is explained very well in the Wikipedia entry.

http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation

这篇关于AES及其密码模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆