Encode integer 'm'
echo " Computes the cipher text c = m^e mod n.
";
echo " $m^$e%$n
";
$digits = `./pow_digits $m $e`;
$gt100_k = `./gt100k $digits`;
echo "digits",$digits;
echo "m^e for this equation will produce a number with approx $digits digits
";
if ( $gt100_k != 1 ) {
$m_to_e = `echo " $m ^ $e " | bc | sed -f ./nlhtml.sed `;
echo $m_to_e;
echo " % $n ";
echo "
this gives the'public key encoded' cipher result
";
echo "";
$c = `echo " ( $m ^ $e ) % $n " | bc`;
echo $c;
}
else {
echo " The number of digits produced by the exponentiation of m^e is greater than 100,0000
";
echo " The resursive (see recursive exponentiation break down ) ";
echo "routines will be applied instead of direct implementation to calculate m^e%n
";
$c = `./cbe.sh 'A $m B $e C $n D'`; // php is very nasty about sending multiple args to scripts
echo " this gives the 'public key encoded' cipher result
";
echo $c;
}
printf("