Is there a tool available for Linux systems that can measure the "quality" of entropy on the system?

I know how to count the entropy:

cat /proc/sys/kernel/random/entropy_avail

And I know that some systems have "good" sources of entropy (hardware entropy keys), and some don't (virtual machines).

But is there a tool that can provide a metric as to the "quality" of the entropy on the system?

  • Im interested, Why would you want to calculate entropy of a system? – whoami Feb 16 '12 at 11:45

http://www.fourmilab.ch/random/ works for me.

sudo apt-get install ent
head -c 1M /dev/urandom > /tmp/out
ent /tmp/out
| improve this answer | |
  • 4
    Cool tool. You can check a device in just one command with dd if=/dev/urandom bs=1M count=1 | ent – l0b0 Jun 13 '13 at 15:22
  • 7
    Note that running an entropy estimator on /dev/urandom is completely useless. /dev/urandom is the output of a crypto-quality PRNG, and an entropy estimator will always give full marks to any semi-decent PRNG. You need to run the entropy estimator on the unconditioned entropy source, which Linux doesn't expose outside the kernel. Cc @DustinKirkland – Gilles 'SO- stop being evil' Mar 28 '15 at 20:44
  • @Gilles there is no way? – Felipe Nov 9 '15 at 21:24
  • @FelipeMicaroniLalli No way to do what? Estimate the entropy from the output of /dev/urandom? Yes. The output of /dev/urandom (or /dev/random, same issue) is the output of a crypto-quality PRNG, and that will always have top marks for entropy estimation. If you want to estimate the entropy, you need to dig into the kernel, figure out what it uses for entropy sources, and measure for a VERY long time. – Gilles 'SO- stop being evil' Nov 9 '15 at 21:43
  • 1
    @FelipeMicaroniLalli No, the entropy source does not affect the PRNG in a way that can be measured. This is rather off-topic for Unix & Linux but I know I've seen it discussed on Cryptography, try searching the tags [entropy] and [randomness] there. – Gilles 'SO- stop being evil' Nov 9 '15 at 22:07

"ent" is an excellent command line tool for a simple and quick estimation of entropy.

I've used it to help learn how linear congruential generators work. But if by "measuring entropy" you mean "measuring randomness"... the problem becomes more complex.

For a more robust test of randomness you should checkout the dieharder test suite: http://www.phy.duke.edu/~rgb/General/dieharder.php

It is not as easy to use as "ent" but it is far more rigorous.

For more in depth study, "Cipher's by Ritter" also provides a good selection of links:


| improve this answer | |

Tools can only ever give you an upper bound on the entropy. For most uses, in particular security related uses you're more interested in a lower bound.

Calculating the entropy of an arbitrary file is mathematically impossible, so there can be no tool that can do it.

I can easily write a file generator that generates very low entropy files, but will still pass your entropy tests. Just use a crypto PRNG with a small seed.

| improve this answer | |

You can use Binwalk with the -E option:

# binwalk -E data

0             0x0             Falling entropy edge (0.000000)
2443264       0x254800        Rising entropy edge (0.988510)

You can get the source code from its GitHub repository.

| improve this answer | |

ncomputers.org/entropyarray performs a faster entropy test than ent with 16, 32, 64, 128, 256 and 512 bits serial correlation tests.

with ncomputers.org/entropy tool, you may also perform visual frequency and distribution tests, plotting the outputs entropy.freq and entropy.gaus

as an example you may perform an online test of up to 1GB using servertest.online/entropytest

entropy.freq entropy.gaus

| improve this answer | |

I think you are looking for:

cat /proc/sys/kernel/random/entropy_avail
| improve this answer | |
  • Sorry, no, I'm well aware of entropy_avail. I'm trying to measure the quality of that entropy. – Dustin Kirkland Feb 15 '12 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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