Questions tagged [entropy]

Entropy is a measure of how predictable the outcome of a random process is, or how much uncertainty one has about an unknown quantity in one's state of knowledge, defined in terms of the probability distribution on possible outcomes or quantities.

Entropy is a property of a probability distribution on the set of possible values of a random process or of an unknown quantity. A probability distribution $P$ quantifies the plausibility of each possible value $x_1,$ $x_2,$ $\dotsc,$ $x_n$ by assigning it a numerical probability $P(x_1),$ $P(x_2),$ $\dotsc,$ $P(x_n)$ between $0$ and $1$; the entropy of $P$ is a single measure loosely summarizing the magnitude of uncertainty about what value the random process might yield, or the unknown quantity might actually be.

The two most common kinds of entropy are:

  • Shannon entropy, $H(P) := -\sum_i P(x_i) \log_2 P(x_i)$, is the average number of bits per sample that an optimal compression algorithm tuned for the distribution $P$ can compress random samples from $P$ into.

    Shannon entropy, named after Claude Shannon for his seminal work on information theory, is most often what unqualified ‘entropy’ refers to outside cryptography in information theory and coding theory. Shannon entropy is useful for estimating the average cost of transmitting samples of $P$ by telegrams that you must pay for by the bit.

  • Min-entropy, $H_\infty(P) := -\log \max_i \log_2 P(x_i)$, is the number of fair coin tosses that all come up heads with the same probability as the best strategy of guessing a sample from $P$ on the first try.

    Min-entropy is the number of fair coin tosses coming up heads that the best guess for a single outcome has the same probability as, and is most often what unqualified ‘entropy’ refers to in cryptography. Min-entropy is useful for estimating an adversary's probability of success at guessing a key in a single trial.

Example. A four-sided die with probability 1/2 of turning up 1, probability 1/4 of turning up 2, and equal probabilities 1/8 of turning up 3 or 4, can be compressed into messages, say for transmission by telegram which costs by the bit, as follows:

  • Transmit the face 1 as a 0 bit.
  • Transmit 2 as the bit string 10.
  • Transmit 3 as 110.
  • Transmit 4 as 111.

The most probable outcome, rolling a 1, has the same probability as a single fair coin toss coming up heads, 1/2. Thus the min-entropy is 1 bit.

The average number of bits per sample in this compression scheme is the sum of each number of bits weighted by its probability. A straightforward calculation shows that this compression scheme is optimal, because the average number of bits coincides with the Shannon entropy, namely 1.75 bits.

This example illustrates a theorem the min-entropy is never greater than the Shannon entropy; that is, Shannon entropy is an upper bound on min-entropy, so it is useful in cryptography as a limit on the best min-entropy you can hope for from a physical system.

Rényi entropy is a generalization that covers both Shannon entropy and min-entropy as instances, but it seldom figures into cryptography. Entropy can be measured in other units such as nats, decibans, etc., if computed with base-e, base-10, etc., logarithms instead of base-2 logarithms, but this is seldom seen in cryptography.


Thermodynamic entropy is related to Shannon entropy. In a thermodynamic system characterized by macroscopic averages such as temperature, pressure, volume, etc., the (thermodynamic) entropy change of the system is defined in terms of the macroscopic heat transfer into or out of it and its temperature change.

A priori, this concept of classical thermodynamics may not be obviously related to information theory or probability distributions, but turns out to have an interpretation in terms of the Shannon entropy of a family of probability distributions.

In the microscopic formulation of statistical mechanics, when a thermodynamic system is described in terms of macroscopic averages, there are many possible microscopic configurations that the system could be in that are compatible with the macroscopic averages. Among the probability distributions on microscopic configurations compatible with the macroscopic averages, the maximum Shannon entropy of any such probability distribution is the (thermodynamic) absolute entropy of the system (with an appropriate choice of logarithm base to make the units commensurate), and a change in entropy coincides with a difference of absolute entropies.

Historically, the term entropy was invented by Rudolf Clausius as a macroscopic property of a thermodynamic system, before Ludwig Boltzmann connected it to microscopic configurations in his H theorem and J. Willard Gibbs expounded on it in the development of statistical mechanics. Claude Shannon later stumbled upon the same formula as Gibbs, but from the perspective of channel coding and information theory. Inspired by Boltzmann and Gibbs, Shannon adopted the name ‘entropy’ and letter H for the property of any probability distribution.

394 questions
18
votes
3 answers

Why do "nothing up my sleeve numbers" have low entropy?

As a preface, forgive me for some of the links being from Wikipedia. I realize that academia frowns upon this. I came across this article about "nothing up my sleeve numbers". In it, it says: In cryptography, nothing up my sleeve numbers are any…
asteri
  • 283
  • 1
  • 5
12
votes
1 answer

Relation between entropy and min-entropy

I understand that the entropy is the number of bits that can encode a set of messages. However, I don't understand what the min-entropy is and how it is related to entropy. Let's describe a simple password case: if a password is 100 random bits, is…
graphtheory92
  • 773
  • 5
  • 14
10
votes
2 answers

What is the difference between Shannon entropy and saying that tossing a 6-sided die 100 times has more than 256-bit entropy?

I'm confused. I thought that tossing a 6-sided die 100 times had a greater than 256-bit entropy because $6^{99} < 2^{256} < 6^{100}$. (A similar concept appeared in this XKCD comic, where choosing four random words from a dictionary of presumably…
cryptonamus
  • 233
  • 1
  • 5
8
votes
2 answers

Has human-generated entropy ever been a real problem?

I know the topic of human brains generating random numbers has been discussed here and in Cognitive Sciences before, but I am interested in a particular part of it: In an introductory book to cryptography I read recently ("Cuando la criptografia…
user2891462
  • 267
  • 2
  • 7
6
votes
4 answers

Bits of entropy needed to choose a random element from a list?

Suppose I want to choose a random element from a list of size $2^n$, for any integer $n$. (Here, random is to mean an equal probability of selecting every item.) My intuition says I'd need $n$ bits of entropy. For example, for a list of size 64,…
Philip
  • 169
  • 5
6
votes
3 answers

What is the entropy of a Mersenne Twister (MT)?

From Serious Cryptography: "Entropy is maximized when the distribution is uniform because a uniform distribution maximizes uncertainty: no outcome is more likely than the others. Therefore, n-bit values can’t have more than n bits of entropy." The…
Bastien
  • 511
  • 3
  • 11
5
votes
1 answer

estimating entropy/randomness as fail-safe mechanism

Real-world encryption systems are often not broken algorithmically but because the implementation has a bug. Sometimes the bug only happens in circumstances that could not have been foreseen, such as weak random numbers, or an error in a library…
Marc Lehmann
  • 225
  • 1
  • 4
5
votes
2 answers

Consuming of entropy

When I put: sudo watch tail /proc/sys/kernel/random/entropy_avail && dd if=/dev/random of=/dev/zero It shows that available entropy is "consumed". What I can't understand is: Why does generating random consume entropy? Why does generating random…
Carol
  • 163
  • 4
5
votes
1 answer

What are the key difference between Shannon entropy and Guessing Entropy?

Any body can explain, what are the key differences between Shannon entropy and Guessing Entropy? In some research I got entropy uses binary search or balanced Huffman tree. Guesswork uses linear and unbalances Huffman tree? Also guesswork can…
4
votes
2 answers

Are the GPS coordinates a good source of entropy?

Are the GPS coordinates (latitude and longitude) a good source of entropy? If yes, why? If no, why? The question would investigate on the fact if the GPS location data can be used as source of entropy in the cryptography field, in general. The…
CipherX
  • 381
  • 2
  • 12
4
votes
1 answer

Given enough length, which string of symbols will have the greatest entropy?

Which arbitrarily long string will have the greatest entropy? A string constitued of random letters, with each letter having a probability of being picked equal to its frequency of apparition in the english language. A text written in…
user39469
4
votes
1 answer

Relationship between the use of a mask and entropy

This is part of an assignment and I'm not sure what conclusion I'm supposed to draw from the result. We were supposed to generate two 1024 bytes words, one using an algorithm that randomly generate 0 and 1 (50%/50%) and one using an algorithm with a…
user39469
4
votes
1 answer

Entropy calculation

I calculated the entropy for "variable", "property" and their concatenation "variableproperty" (with e.g. the Shannon Entropy) and got $2.75, 2.5$ and $3.33$ respectively. These are all entropy per byte, if I don't err. But why is the last value…
Mok-Kong Shen
  • 1,312
  • 1
  • 11
  • 15
3
votes
3 answers

Why is Min-entropy significant in cryptography?

Let $H_{min}$ = Min-entropy and $H$ = Shannon entropy. Unless you're gaming the system or deliberately trying to be obtuse, very rarely is $ \frac{H} {H_{min}} > 10$ from any conceivable physical source. To achieve a ratio of >10 in hardware/ real…
Paul Uszak
  • 15,390
  • 2
  • 28
  • 77
3
votes
1 answer

How can I calculate the entropy of an image?

I am searching how can I calculate the entropy of a image for a Capture The Flag. I know what is the entropy theory and I tried a pair of things: Convert the jpg image on binary image and calculate the entropy of binary text. Viewing the images and…
1
2 3 4