问题
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