I don't understand how the key gives you the algorithm, in other words I am having trouble understanding how the key works in symmetric encryption. My book says:

"Symmetric encryption transforms plaintext into ciphertext using a secret key and an encryption algorithm"

So what does the secret key do, is it like a password to give you access to the actual encryption? Also my book says:

"Plaintext message chosen by cryptanalyst, together with its corresponding ciphertext generated with the secret key"

It says "generated with the secret key", so the key creates the algorithm?

  • $\begingroup$ No, the key is one of the inputs to the algorithm. When encrypting you input both the key and the plaintext to produce the ciphertext. You must know the algorithm in addition to knowing the key. $\endgroup$ Feb 20, 2018 at 21:10
  • $\begingroup$ The analogy "key = password" works, at least functionally. In actual practice, the password is processed to become the key, but the function remains. $\endgroup$
    – fgrieu
    Feb 20, 2018 at 21:14

1 Answer 1


The key does not create the algorithm.

The algorithm is a fixed, publicly known set of steps. Clearly, a fixed, publicly known set of steps is not capable of encrypting anything.

So we include some secret information into the steps in the form of a key. A key for a symmetric encryption algorithm is a random sequence of bits that is kept secret. The knowledge of this secret random sequence of bits is what enables one to perform the encryption/decryption steps - and what prevents anyone else from doing the same.

For example, the AES algorithm uses the following steps:

  • Add key
  • Add constant
  • Mix Columns
  • Substitute bytes

The Add key step is the same instruction for everyone who uses the algorithm, but the data that the instruction operates on is different for everyone because of the key.

This may be the source of the confusion. There are two things going on in an encryption algorithm:

  • The instructions, or steps that are applied
  • The data, which are the bits of information that the instructions operate upon

The instructions (the algorithm) are fixed and publicly known. The key is data, and it provides the source of secrecy that enables one to compute the encryption/decryption operation. The plaintext and ciphertext are also data, which are operated upon by the instructions in conjunction with the key.

  • 1
    $\begingroup$ Is the AddRoundKey() the same as Add Constant or Add Key bullet? $\endgroup$
    – Q-Club
    Feb 21, 2018 at 2:07
  • $\begingroup$ @Q-Club Yes, Add Key should say AddRoundKey to be more precise. However I don't want to convolute the simple question/answer by introducing the idea of round keys as opposed to the key that parameterizes the algorithm. It's not technically correct, but I think the extra detail would detract towards the enlightenment of the asker. $\endgroup$
    – Ella Rose
    Feb 21, 2018 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.