Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

4 Answers 4

up vote 6 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 at 20:44

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

"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:

http://www.ciphersbyritter.com/NETLINKS.HTM#RandomnessLinks

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

 
discard

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.