# CBC mode works well for input greater than “b” bits. What is that “b” bits?

This post on geeksforgeeks.org about block cipher modes of operation, says that one of the advantages of the CBC is that it works well for input greater than b bits. I also saw that in the book "cryptography and network security by William Stallings". But neither of them said what exactly is that b bits. Can anyone explain? thanks.

• I'd ignore that post; they claim the only disadvantage of ECB is "Prone to cryptanalysis since there is a direct relationship between plaintext and ciphertext"; obviously, the main disadvantage of ECB is that it does not disguise patterns in the plaintext (see the famous encrypted penguin here en.wikipedia.org/wiki/Block_cipher_mode_of_operation#ECB If they get something that simple wrong, I wouldn't trust them – poncho Dec 17 '20 at 17:32
• They also say "CBC is a good authentication mechanism" - huh??? CBC does not do any authentication at all... – poncho Dec 17 '20 at 17:34
• @poncho thank you so much for this information. – Masoud jt Dec 17 '20 at 18:18

There the $$b$$ bits mean the block size of the Encryption and that is 64 for DES and 128 for AES.

Therefore you may need more than one block for the encryption of your plaintext (message). If your message size is $$\ell$$ than you need $$\lfloor \frac{\ell}{b} \rfloor + 1$$ blocks to encrypt.

The block nature of the CBC mode like any other, not like CTR, requires padding to fill the empty bits of the last block. Usually, the PKCS#7 padding is used for this. PKCS#7 can increase the number of blocks by one if $$b|m$$.

Note that if the CBC mode is used with servers like in TLS, then it is vulnerable to padding oracle attacks that work like decryption oracle. In this case, you may need to get rid of the CBC as TLS 1.3 did and use paddles mode like CTR. The better is using authenticated encryption modes like AES-GCM which internally uses the CTR mode and provides integrity and authentication with GMAC.

Keep in mind that, Wikipedia is the first source to look at those, not any other site.

If you really want to use CBC mode then

4. The message size must not exceed $$2^{60}$$.
5. The key must not be used more than $$2^{45}$$ due to the IV collision due to the birthday attack. This will produce $$(2^{45})^2/2^{128}/2 = 2^{90 - 128-1} = 1/2^{39}$$ probability of collision instead of $$1/2$$ probability of $$2^{64}$$