Please can someone explain the difference between a cryptographic ‘Key Space’ and ‘Key Length’

202 views

I’ve just started a cryptography section of an exam I’m studying for and I just don’t understand these terms. Please can someone explain what they are and how they differ from different algorithms – thanks! 🙂

In: 2

3 Answers

Anonymous 0 Comments

Key length is the number of bits in the key. Key space is the set of all possible keys.

For example, if the key is 128 bits long, then the key length is 128 while the key space is all the 2^128 possible 128-bit keys.

Anonymous 0 Comments

Imagine you have 3 different colloured blocks and have to use all of them to create a pattern. In this case your Key lenght is 3.

Now you have to do order them and find all possible ways to order them.All the possiblle ways, in this case 3^(3) = 27, are the Key Space.

Anonymous 0 Comments

Lets for example say that you need a 1024 bit key length. So to store that key you need 1024 bits. But you can not really use all those possible keys. If your key is 1 then it may still be 1024, just with lots of leading 0’s. But it is a very bad key as it is easily decrypted. So in practice the first bit needs to be a 1 to get a big number so you have a key space of 1023 usable keys.

But that is just the start. Your key might have to be a prime number. First off all the even numbers are removed from the key space leaving 1022 bits. In fact if you eliminate all the non-primes you are only left with 1013.5 bits in your key space, even though your key length is still 1024.

The more restrictions you put on the key the smaller the key space is which could be a problem when faced with brute force algorithms and birthday attacks. If your key space is too small you need to increase the key length which adds computing complexity. Ideally the key space is the same size as the key length but this is hard to accomplish.