AES and its cipher modes

不问归期 提交于 2020-01-16 03:41:29

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/8357765/aes-and-its-cipher-modes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!