AES ECB vs CBC
Which encryption to use ? ECB is faster. ECB, Electronic Code Book, encrypts two identical blocks into two identical cipher texts. Because of this, it is considered insecure. CBC is slower. CBC, Cipher Block Chaining, involves XORing the plaintext of each block with the previous block’s ciphertext before encrypting. This ensures that if two blocks of plaintext are identical they will produce totally unrelated ciphertext blocks. The “slower” is due to the time required to perform the XOR operation. Using ecb: Key used: 14SZXSWWcB1MXZD09Y1tMOri2kYRsUAHBpjXULetJ8s= Plain text 1: sahkfaskjdaasfhkasfasdf Cipher text: y3Pjdo1Ffkc0Db4IRBRKOPQIerrifGgAiZA8uUS8yLc= Now changing plain text 1 on second position (a changes to c) Plain text 2: schkfaskjdaasfhkasfasdf Cipher test generated: 4uAHU8xLRn/iX+udKBLxjPQIerrifGgAiZA8uUS8yLc= Here ecb generates identical cipher (only first characters have changed) Encryption with mysql: SET SESSION block_encryption_mode = 'aes-256-ecb'; select TO_B...