4

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?

rath
  • 2,598
  • 3
  • 27
  • 40
TheRookierLearner
  • 1,011
  • 1
  • 11
  • 15

1 Answers1

3

In contrast to asymmetric schemes (notably RSA and El Gamal) which require some sort of computation to generate the key, the only constraint one has when selecting a key for DES or AES (or 3DES) is to make it look indistinguishible from a random stream. That said both El Gamal and RSA require some randomness in key generation, but that phase does not depend just on that.

You could however use any byte stream of sufficient length as a key, irrespective or randomness, at your peril. That's because the security of these schemes (of all schemes really) depends on the inability of some adversary to compute or guess the key in some practical timeframe. It's worth mentioning here that DES keys can be (and have been) efficiently brute-forced because they are short in length. Search this site for randomness test or take a look at the randomness tag to get a better idea.

In practice it's possible to derive a key from a password, passphrase or a random stream of smaller length by using a key derivation function. You may also use any CSPRNG to generate a long enough stream, which you can use as a key.

rath
  • 2,598
  • 3
  • 27
  • 40