# How does blocksize affect security?

I have recently read about how blockciphers and how stream ciphers work, and although I think I finally got everything right, I'm still wondering how increasing blocksize increases security.

Block ciphers are usually used in modes of operation. The security of a mode of operation depends on two things: the security of the underlying block cipher, and the security of the mode itself when you replace the block cipher with an "ideal" permutation.

Say you're using a block cipher with block size $n$ bits, so with AES-256, $n = 128$ (the 256 refers to the key size). A good block cipher should be a pseudorandom permutation, meaning when you give it a uniformly distributed key, it should be difficult to distinguish it from an ideal permutation. An ideal permutation is a uniformly randomly generated permutation over all permutations from $n$ bits to $n$ bits, basically a mathematical object.

Determining whether a given block cipher is secure means cryptanalyzing it to make sure there are no obvious attacks. Such attacks make use of the structure of the block cipher, so for example, this would mean looking at the S-boxes in AES-256 and seeing how they interact with each other, and performing differential, linear, and other types of cryptanalysis. None of these techniques make explicit use of the block size, hence having a smaller block size does not mean you will be able to distinguish a block cipher from an ideal permutation more easily. So when it comes down to block cipher security, the block size does not play an important role.

In contrast, mode security depends strongly on the block size. I mentioned earlier that you also need to look at mode security when the block cipher is replaced with an ideal permutation. Once you do this, you can theoretically analyze the modes and even explicitly compute how its security degrades as you use it. To give an example, GCM has a security degradation of roughly $\sigma^2/2^n$, which represents adversary success probability, with $\sigma$ the number of permutation calls. This means that the more data you process with GCM, the more exposed the mode becomes. The reason this happens is because GCM's security relies on the ideal permutation being "hidden" from the adversary, and as you use GCM you increasingly expose the hidden permutation.

So putting everything together, even if you know that your block cipher on $n$ bits is indistinguishable from an ideal permutation on $n$ bits, your security will still degrade when you use the block cipher in a mode. Hence if you have the option of using a block cipher with small block size, or a block cipher with large block size, then it is better to use the block cipher with larger block size since you'll be able to use it in a mode much longer (assuming all else equal, meaning the cipher is secure for both block sizes).

• hmm now i wonder, can you encrypt multiple blocks without a mode of operation? – blacklight May 20 '16 at 9:00
• Well, the definition of a mode of operation is exactly that: using a block cipher multiple times. You can use the block cipher in a way that creates an authenticated encryption scheme, like GCM, or you can use the block cipher and achieve hardly anything, like ECB. Basically, these are fundamental limits to using a block cipher. However, if you use a block cipher in a very clever way, then you can get around some of these limits (beyond birthday bound modes) – pxdnr May 20 '16 at 9:09
• but is it then possible to encrypt a file, block by block(without have a mode connecting them), and decrypt them later, block by block(assuming that you have noted down the order in which they need to be decrypted). sorry if this sounds like a stupid question. – blacklight May 20 '16 at 9:12
• Not at all a stupid question. You could process a file block by block, without connecting the blocks. This is called ECB mode, or Electronic Codebook mode. However, this would give you little security; check out the wikipedia entry on ECB for an example. – pxdnr May 20 '16 at 9:26
• @blacklight: See also Why shouldn't I use ECB encryption? – Ilmari Karonen May 20 '16 at 12:15

Block size does not directly affect the security of the cipher. However, if block size is too small, it can prevent you from using the cipher securely.

The main effect of block size is due to the fact that a block cipher is meant to be a pseudorandom permutation (PRP). That means that any two inputs will have outputs that differ iff the inputs differ. So seeing two equal block cipher outputs under the same key you know the inputs were equal as well.

With most modes of operation, this means that you can only use the block cipher as long as these collisions remain unlikely. This limit is determined by the block size: as you approach the birthday bound of $2^{b/2}$ blocks encrypted (with $b$ the block size in bits}, it is increasingly likely the output is equal to some output seen before.

The exact boundary and effect of block size depends on the mode used.