#!/bin/csh # Syntax: Create_Seed file1 file2 file3 > outputfile # # file1, file2 contain the two Key Primes, p and q # file3 contains an initial starting point from which seed is generated # stdout will be written with an approved seed -- a quadratic residue # modulo p*q if ($#argv != 3) then echo "Usage: " $0 " keyfile1 keyfile2 initializer" exit 1 endif if ( ! -e $1 ) then echo "Cant find file " $1 exit 1 endif if ( ! -e $2 ) then echo "Cant find file " $2 exit 1 endif if ( ! -e $3 ) then echo "Cant find file " $3 exit 1 endif # cook up a name for a temporary workfile set tf = ./seed_ugh.$$ # first, grab the bc program that calculates quadratic residues cp ./find_residue_bc $tf chmod 777 $tf # grab the first Blum integer from keyfile1 echo ' p = \' >> $tf cat $1 >> $tf # grab the second Blum integer from keyfile2 echo ' q = \' >> $tf cat $2 >> $tf # grab the initial starting point for the seed from initializerfile echo ' i = \' >> $tf cat $3 >> $tf # tell bc to execute the quadradic-redidue-seedfinder routine named s echo "s(p,q,i)" >> $tf # fire up bc. Output goes to stdout as desired. bc < $tf # clean up the excess rm $tf