# How to choose keys for a block cipher?

AES and DES are block ciphers. Mathematically, its the mapping from plaintext space to ciphertext space using the keys i.e. $\{{0,1}\}^k$ x $\{{0,1}\}^l \longrightarrow \{{0,1}\}^l$

I know that these keys are random. What I want to know is how these are calculated in real world and is there any way to change these keys meaning that is it possible for me to use my own keys in these block ciphers?

-
The keys $k$, $l$, etc.. are just variables. You can put whatever key you want in there (as long as it is 56 bits long, or 128 bits long, or whatever the key length for the given cipher is) and you will get one of the possible permutations of the cipher (parameterized by the key). Are you asking how those keys are generated e.g. how they are derived from passwords for instance and so on? – Thomas Sep 18 '13 at 12:05
DES keys, at least not if you look at the complete encoded binary form, are not random. They contain parity bits. This was one of the drawbacks of DES that was removed in AES. And actually, block cipher keys should consist of bits indistinguishable from random. If they were completely random then keys generated by a KDF (e.g. from a password) would be invalid. – Maarten Bodewes Sep 18 '13 at 14:59
@Thomas - I know that functions like PBKDF2 are used to derive keys from Passwords. However, I didn't know that these functions are also used to derive keys for the block cipher. I always thought that these keys were hard coded/pre-programmed in to the circuit. Are you asking how those keys are generated e.g. how they are derived from passwords for instance and **so on** ? (This could be a separate question but) What are the other methods to derive keys other than passwords? – TheRookierLearner Sep 18 '13 at 16:58
@owlstead - +1 Thanks for the info. That is something I didn't really know. – TheRookierLearner Sep 18 '13 at 17:01