On Wednesday 24 August 2011 00:53:06 Michael Uleysky wrote:
> 2011/8/24, luxInteg <[email protected]>:
> > Greetings ,
> > 
> > I would be grateful if someone could advise on the   saving  and
> > retrieving of
> > the  random seed on a BLFS installation   and if  the  random-seed cant
> > be saved how does one generate one on boot from say time sources  or
> > whatever. (
> > when the only writable  area is /tmp)
> 
> Do you mean seed for /dev/urandom?
> If so, you can use following script
> 
> # Get number of seconds since epoch (or date in any other format).
> D=`date +%s`
> # Get some (pseudo)random data (better to use /dev/random instead of
> /dev/urandom but this may be dangerous if /dev/random does'nt have
> sufficiently amount of random data).
> R=`dd if=/dev/urandom count=64 bs=1 2>/dev/null`
> # Calculate sha512 hash of concatenation of our two data. It will be
> our random seed.
> St=`echo -n "$R$D"|sha512sum -b|sed "s/ .*//"`
> # Convert hash to string with hexes.
> S=`echo $St|sed -r 's/([0-9a-f]{2})/\\\\x\1/g'`
> # Write our seed in binary form to /dev/urandom.
> echo -ne $S>/dev/urandom
> 
> So, you generate a seed which depends on current time and random data.
> 
> Michael Uleysky

thanks
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to