Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We discuss a lot of topics and use measures of entropy to determine how difficult it is for an attacker to be successful. What does entropy mean in the context of cryptography? How is entropy calculated in the general case?

share|improve this question
I think of entropy like this: Say the attacker wants to know your password and you are willing to tell her the password by answering her questions... What is the minimum number of questions with yes/no answer the attacker needs to ask in order to find the password? – Panos K. Jun 29 at 16:01
up vote 21 down vote accepted

In information theory, entropy is the measure of uncertainty associated with a random variable. In terms of Cryptography, entropy must be supplied by the cipher for injection into the plaintext of a message so as to neutralise the amount of structure that is present in the unsecure plaintext message. How it is measured depends on the cipher.

Have a look at the following article. It provides a survey of entropy measures and their applications in cryptography: "Entropy Measures and Unconditional Security in Cryptography (1997) "

share|improve this answer

To give you a short answer to your question: The common notion of entropy is the notion of Shannon entropy. The information content $H_x$ of a value $x$ that occurs with probability $\Pr[x]$ is $$H_x = -\log_2(\Pr[x]) \text.$$ The entropy of a random source is the expected information content of the symbol it outputs, that is $$H(X) = E[H_X] = \sum_x \Pr[x]H_x = \sum_x -\Pr[x]\log_2(\Pr[x]) \text.$$

You can interpret this as the expected uncertainty about a symbol $x$ knowing only the distribution according to which $x$ is chosen. For the case of bit strings the important message is, the entropy not always equals the bit length of $x$. I.e. if you want to seed a pseudo-random generator, it is important to choose a seed with high entropy. If you use the actual time as seed the entropy of the seed is very low, as everybody can easily guess parts of the seed (year, day, perhaps even hour and minute). Ask Netscape, they should have learned this…

There are several other notions of entropy all discussed in the other answer, but I think this is the most important one, if you don't want to study complexity or information theory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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