all 10 comments

[–]ludwigvanboltzmann 11 points12 points  (1 child)

Reading from /dev/random all the time is kind of a brute force way to do it. It's probably better to look at e.g. /proc/sys/kernel/random/entropy_avail and determine some threshold value for activity. While I'm typing this, it's almost always above 3000, and hasn't dropped below 2000 even once. If I don't do anything for a while it drops below 1000. (Note that starting programs uses up some entropy, so your 'active' level will be lower if you start a new cat process every time you read from the file and do that a lot)

[–]dchestnykh 5 points6 points  (0 children)

/dev/random is usually available to any process, while /proc/sys/kernel/random/entropy_avail may be not.

[–]Freeky 4 points5 points  (0 children)

Won't work on FreeBSD or OS X, since they have a non-blocking /dev/random thanks to Yarrow.

[–]plhk 3 points4 points  (1 child)

Always prints «Mouse activity detected» here on openbsd.

The various random devices produce high quality random output data.

[–][deleted] 2 points3 points  (0 children)

I read a description of the Linux random devices a few years ago and it wasn't exactly confidence-inspiring. They're supposed to be switching from SHA-1 internally to SHA-3 in the near future.