Key space (cryptography)


In cryptography, an algorithm's key space refers to the set of all possible permutations of a key.

Description

To prevent an adversary from using a brute-force attack to find the key used to encrypt a message, the key space is usually designed to be large enough to make such a search infeasible. On average, half the key space must be searched to find the solution.
Another desirable attribute is that the key must be selected truly randomly from all possible key permutations. Should this not be the case, and the attacker is able to determine some factor that may influence how the key was selected, the search space can be significantly reduced. Humans do not select passwords randomly, therefore attackers frequently try a dictionary attack before a brute force attack, as this approach can often produce the correct answer in far less time than a systematic brute force search of all possible character combinations.

Examples

If a key were eight bits long, the keyspace would consist of 28 or 256 possible keys. Advanced Encryption Standard can use a symmetric key of 256 bits, resulting in a key space containing 2256 possible keys.
In the DES block cipher, 56-bit key is used, resulting in a relatively small key space of size 256, which, as was demonstrated in 1998, can be searched exhaustively in 56 hours with a desktop computer.