//
you're reading...
howto, Linux

How to Increase the Entropy in Linux

The Linux Kernel generates entropy from keyboard timings, mouse movements and IDE timings and makes the random character data available to other operating system processes through the special files /dev/random and /dev/urandom.

On my laptop the Entropy is around 178.

Many times i have got the following message when i try to generate a security certificate;

“Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy…”

What to do to increase entropy ..

1) install rng-tools
pilio1@pilio-laptop:~$ sudo apt-get install rng-tools

2) add the following settings in /etc/default/rng-tools

HRNGDEVICE=/dev/urandom
RNGDOPTIONS=”-W 90% -t 1″

3) restart the rngd daemon

root@pilio-laptop:~# /etc/init.d/rng-tools restart
Stopping Hardware RNG entropy gatherer daemon: rngd.
Starting Hardware RNG entropy gatherer daemon: rngd.
root@pilio-laptop:~#

To watch Entropy issue the followng command

root@pilio-laptop:/# watch -n 1 cat /proc/sys/kernel/random/entropy_avail

Every 1.0s: cat /proc/sys/kernel/random/entropy_avail Sun Mar 27 21:26:13 2011
3968

Now you are ready to be rich .. 🙂

#!/usr/bin/perl

@mynumbers=();
$found=0;
$howmany=0;
$random=-1;

while ($howmany<12)
{
$found=0;
$random = int( rand(80)) + 1;
for($k=0;$k<$#mynumbers+1;$k++)
{
if ($random == $mynumbers[$k]) {$found=1; last;}

}
if ($found==0){

push(@mynumbers,$random);
$howmany++;
}#//endif

}#//end while

foreach(@mynumbers){

printf (“‘%2d'”,”$_”);

}
print “\n”;

Let’s Generate some keno numbers …

root@pilio-laptop:/keno# while true; do perl rand1.pl; sleep 1; done
’31”80”53”67” 8”79”23”52”45”77”22”27′
‘ 7”66”20”15”35”78”32”14”38”61”10”79′
’50”34” 7”11”63”28”16”51”26”22” 8”43’
‘ 4”78”39”69” 1”61”18”66”29”17”10”76′
’14”54”79”69” 6”31”41”37” 9”67”60”59′
’66”60”34”48”10”45”22”33”53”18” 4”30′
’45”47”77”34”10”57” 9”56”79”70” 3”62′
’53” 4”80”70”76”59”77”26”79”23”24”19′
’60”36”14”79”10”51”64”30”24”43”21”74′
’72”68”35”33”31”62”57”38”29”25”39”15′
’35” 6”28”24”42” 3”43”48”47”20”26”74′
’33”54”56”68” 2”53”50”75”78”17”30”48′
’12”32”67”72”42” 8”78”68”16”57”74”47′
’42”61” 4”78”46”15”37”45”31”51” 5”36’
‘ 5”15”60”21”14”11”74”28”58”33”26”41′
’79”17”62”38”29”35”46”77”69” 5”15”65′
’64” 9” 6”26”52”75”78” 3”46”35”10”28′
’48”79”74” 3”24”14”56”59”76”11” 7”17′
’47”21”33”46”52”26” 7”38”23”44”59”63′
’30”12” 6”20”74”70”71”34”75”80” 5”35′
’38”28”44” 1”58”14”43”62” 8”32”21”20′
’72”51”31” 4”34”30”73”54”12”38” 5”15′
’73”80”22”33”23”16”25”79”59”63”46”40’
‘ 3” 6”61”71”59”64” 9”21”62”44” 7”28′
’37”54”64”39”80”11”74”46”41”78”20”62′
’78”37”51” 9”43”39”34”48”60”70”76”23’
^C
root@pilio-laptop:/keno#

Good Luck !

Advertisement

Discussion

Comments are closed.

%d bloggers like this: