# The key size of an ideal block cipher

My understanding of an ideal block cipher is as follows:

For a block cipher with block size $$n$$, there are $$2^n$$ possible plaintexts. The number of possible keys (mappings) would then be $$2^n!$$.

The size of a single key would then be $$2^n$$ because you're choosing one full permutation from the set of all possible permutations.

EDIT: Now that I think about it some more, the key size would be the required number of bits to express the number of possible permutations. So for 24 permutations, that would be a 5-bit key size. For 40,320 permutations, that would be a 16-bit key size.

Is this correct?

• @kelalaka Where I'm lost is how to properly calculate the key size in bits for an ideal block cipher given a particular block size. See edit. Jan 31, 2019 at 14:27
• have a look at the first link and third . Actually, they contain your answers. Jan 31, 2019 at 14:27
• Note: here, the ideal is a vague term. The key size must be determined according to many aspects; the importance of the data, you want to keep it secure for 50 or 100 years? The computation power of the enemy. What if QC is ready. etc. Jan 31, 2019 at 14:41

Ideally, each key $$k$$ select a permutation of all possible permutations $$2^n!$$ for a block cipher with block size $$n$$. So when we say 128-bit key we expect that they represent $$2^{128}$$ permutations from possible ones. Some keys might be very bad, maybe just inverting the plaintext or some acts as a counter, we don't know.
Your calculations are correct if the random selection has no collisions, i.e. there may be two keys that represent the same permutations. We don't expect this collision since $$2^{128}$$ is very small compared to $$2^n!$$.