[colug-432] Random Generator
Chris Spackman
chris at osugisakae.com
Sun May 25 23:33:19 EDT 2014
On 2014/05/25 at 09:57pm, George Larson wrote:
> On Sun, May 25, 2014 at 9:50 PM, George Larson <george.g.larson at gmail.com>wrote:
> We're using 'random.org' which uses atmospheric noise to do
> randomness. We grab more lines than needed (i.e., 25) then we list
> the first X (pseudorandom from shell) and then take the last one of
> those.
Thank you, this is very cool. I think I am following what you are
doing.
Would it weaken the security significantly if we mixed the results
with a similar process, conducted locally? For example, here is a
similar script, based on yours, that gets 25 strings from Random.org
and 25 from the program pwgen. Concatenates the two together, sorts
them (to mix them up), and then finishes (as yours does) by randomly
choosing several and using the last two.
******** script below ************
** no promises that this won't **
** make bash-foo gurus go blind **
**********************************
#!/bin/bash
LIST01=`pwgen -1 --secure 20 25`
LIST02=`curl -s
'https://www.random.org/strings/?num=25&len=20&digits=on&loweralpha=on&upperalpha=on&unique=on&format=plain&rnd=new'`
FULL_LIST="${LIST01} ${LIST02}"
#now convert spaces back to lines and then sort (to mix them up
[probably weakens teh security?])
echo -e "$FULL_LIST" | sed "s/ /\n/g" | sort | head -$(( (RANDOM %
50)+1 )) | tail -2 | perl -pe 's/\n//'
# just to get the prompt to the next line, instead of on the same
# line as the results
echo -e ""
exit
***** end of script *****
--
Chris and Yoshiko Spackman
Respect is earned. Trust is gained. Loyalty is returned.
More information about the colug-432
mailing list