Talking about symmetric encryption, I have 3 elements which I keep trying to puzzle together: IV, encryption mode, and padding.
My question really is which of these elements makes the ciphertext be random?
What I believe right now:
Padding: The padding does not "add" randomness. It only solves the problem of being able to divide the plaintext into the block size defined.
Encryption mode: Here I have a little bit of confusion. So, lets compare ECB mode with CBC mode. As far as I know, the problem with ECB is that, for example, if I have two plain text that I want to encrypt:
P1A, P1B P2A, P2B
where P1A would be the first block of plain text 1.
If P1B and P2B are the same, then C1B and C2B would also be the same, even if P1A and P2A are different. ¿Am I right? Therefore is easy to "swap" ciphertext blocks of data.
On the opposite side. CBC mode (without details) chains the ciphertext blocks one with another. Therefore, if we apply CBC mode to the last example. C1B and C2B would not be the same.
But.. And here is one of my questions. The mode "by it self", in this case CBC, does not add randomenes right? Because the ciphertext will always be the same for the same plain text. Am I wrong? Is there any mode that obtains randomness by itself?
IV: And at last, the IV, which I think is actually the only element from these 3 which makes the cipher text be random.
How much wrong am I?
Thank you and sorry if I made some mistake with the technical language of crypto.