Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

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?

share|improve this question

migrated from crypto.stackexchange.com Feb 15 '12 at 19:03

This question came from our site for software developers, mathematicians and others interested in cryptography.

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

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

sudo apt-get install ent
head -c 1M /dev/urandom > /tmp/out
ent /tmp/out
share|improve this answer
this is good thanks @Marcin – Nikhil Mulley Feb 16 '12 at 23:46
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
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 Mar 28 '15 at 20:44
@Gilles there is no way? – Felipe Micaroni Lalli Nov 9 '15 at 21:24
@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 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:


share|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.

share|improve this answer

I think you are looking for:

cat /proc/sys/kernel/random/entropy_avail
share|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 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.