updated for php5 and

made it create a bc script for larger keys (rather thn make the web page
wait for the long calculations).
This commit is contained in:
Robin P. Clark 2016-01-26 10:27:43 +00:00
parent eeca71b73c
commit a4b3002f75
14 changed files with 158 additions and 146 deletions

View File

@ -1,8 +1,7 @@
# recursive routine to calculate c^d%n # recursive routine to calculate c^d%n
# by reaking it down. Works only where # by breaking it down using residues.
# d is a power of 2.
# #
define x ( c,d,n) { define x ( c,d,n) {
#-1; d; -1; #-1; d; -1;
@ -41,4 +40,3 @@ define t(c,d,n) {
} }
} }

View File

@ -1,12 +1,13 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> PI - calculated to required precision </h1> <h1> PI - calculated to required precision </h1>
<? <?php
$e = $_POST['e']; $e = $_POST['e'];
$d = $_POST['d']; $d = $_POST['d'];
$p = $_POST['p']; $p = $_POST['p'];
$n = $_POST['n']; $n = $_POST['n'];
$q = $_POST['q']; $q = $_POST['q'];
$precision = $_POST['precision'];
$phi = $_POST['phi']; $phi = $_POST['phi'];
$mprivate = $_POST['mprivate']; $mprivate = $_POST['mprivate'];
@ -21,6 +22,8 @@ printf(" <h2> which is the result of %d decimal places </h2> \n", $precision);
$date = `date`; $date = `date`;
printf(" <p>End Time == %s </p>\n",$date); printf(" <p>End Time == %s </p>\n",$date);
?> ?>
<p> <p>
<center> <center>

38
cbe.sh
View File

@ -2,13 +2,15 @@
# Calculate large exponent # Calculate large exponent
#echo "cbe.sh called BASH SCRIPT"
# php in 'safe mode' (god dag yx skaft) # php in 'safe mode' (god dag yx skaft)
# passes the parameters sent in one string # passes the parameters sent in one string
# turning off safe mode in the php.ini file # turning off safe mode in the php.ini file
# does not seem to change this behaviour. # does not seem to change this behaviour.
# to overcome this sed will extract the variables # to overcome this sed will extract the variables
#echo $1 #echo "argument 1:" $1
# #
c=`echo $1 | sed 's/.*A \([0-9]*\) B.*/\1/'` c=`echo $1 | sed 's/.*A \([0-9]*\) B.*/\1/'`
d=`echo $1 | sed 's/.*B \([0-9]*\) C.*/\1/'` d=`echo $1 | sed 's/.*B \([0-9]*\) C.*/\1/'`
@ -21,26 +23,26 @@ args=`echo "<p> c " $c " d " $d " n " $n "</p>"`
date=`date | sed 's\:\_\g' | sed 's\ \_\g'` date=`date | sed 's\:\_\g' | sed 's\ \_\g'`
#echo $date echo "date on this server" $date
echo "<br><hr>"
# create a bc script to calculate this.
# php5 is sopposed to have bc embedded...
#
cat calc_big_expon.bc > calc_big_expon.$$.$date.bc
#echo " calc_big_expon.bc > calc_big_expon.$$.$date.bc "; #echo " calc_big_expon.bc > calc_big_expon.$$.$date.bc ";
echo "r=1;" >> calc_big_expon.$$.$date.bc echo "<br><hr>"
echo "t($c,$d,$n);" >> calc_big_expon.$$.$date.bc echo "created a custom bash script to run to decode using the secret key using residues"
echo "r;" >> calc_big_expon.$$.$date.bc echo "<br><hr>"
echo " custom bc script produced "
echo "<pre>"
cat calc_big_expon.bc
echo "r=1;"
echo "t($c,$d,$n);"
echo "r;"
echo "</pre>"
#echo "invoking bc "
#more calc_big_expon.$$.$date.bc
#bc < calc_big_expon.$$.$date.bc
#echo "bc invoked "
#ls -l calc_big_expon.$$.$date.bc echo "<br><hr>"
result=`bc < calc_big_expon.$$.$date.bc | tail -1` Use the above bc script to decode the message.
#echo $args $result echo "<br><hr>"
echo $result
rm -rf calc_big_expon.$$.$date.bc

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> Encode integer 'm' </h1> <h1> Encode integer 'm' </h1>
<? <?php
$c = $_POST['c']; $c = $_POST['c'];
$m = $_POST['m']; $m = $_POST['m'];
@ -47,29 +47,31 @@ if ($gt100_k != 1) {
echo $clear; echo $clear;
} }
else { else {
echo "<h3> The number of digits produced by the exponentiation of c^d is greater than 100,0000 </h3>"; echo "<h3> The number of digits produced by the exponentiation of c^d is greater than 100,000 </h3>";
echo "<h3> The resursive (see <a href=\"maths.html\"> recursive exponentiation break down </a>) routines will be applied instead to calculate c^d%n </h3>"; echo "<h3> The resursive (see <a href=\"maths.html\"> recursive exponentiation break down </a>) routines will be applied instead to calculate c^d%n </h3>";
$clear = `./cbe.sh 'A $c B $d C $n D'`; // php is very nasty about sending multiple args to scripts $clear = `./cbe.sh 'A $c B $d C $n D'`; // php is very nasty about sending multiple args to scripts
echo "<h3> this gives the 'in clear' result </h3>";
echo $clear;
echo $clear;
echo "<h3> The resursive routines can take some time to run, too long to leave a web page waitng! </h3>";
echo "<h3> If you don't have `bc' on your system, grow up and get a proper operating system. </h3>";
} }
$me = `whoami`;
$date = `date`; $date = `date`;
printf("<p> End Time == %s</p> \n",$date); printf("<p> End Time == %s me=%s</p> \n",$date,$me);
printf("<form enctype=\"multipart/form-data\" method=\"post\" printf("<form enctype=\"multipart/form-data\" method=\"post\"
action=\"encode_pub.php#KEYS\">"); action=\"encode_pub.php#KEYS\">");
?> ?>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=c value=<? echo $c ?>> <input type="hidden" name=c value=<?php echo $c ?>>
<input type="hidden" name=m value=<? echo $m ?>> <input type="hidden" name=m value=<?php echo $m ?>>
<input type="hidden" name=digits value=<? echo $digits ?>> <input type="hidden" name=digits value=<?php echo $digits ?>>
<table> <table>
<tr> <tr>
<td> <td>

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> Encode integer 'm' </h1> <h1> Encode integer 'm' </h1>
<? <?php
$e = $_POST['e']; $e = $_POST['e'];
$d = $_POST['d']; $d = $_POST['d'];
$p = $_POST['p']; $p = $_POST['p'];
@ -43,14 +43,14 @@ else {
action=\"encode_pub.php#DECODE\">"); action=\"encode_pub.php#DECODE\">");
?> ?>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=c value=<? echo $c ?>> <input type="hidden" name=c value=<?php echo $c ?>>
<input type="hidden" name=m value=<? echo $m ?>> <input type="hidden" name=m value=<?php echo $m ?>>
<table> <table>
<tr> <tr>
<td> <td>

View File

@ -5,7 +5,7 @@
<h1> RSA Interactive Simulator / Work Bench : Encoding data with the public Key </h1> <h1> RSA Interactive Simulator / Work Bench : Encoding data with the public Key </h1>
<? <?php
$c = $_POST['c']; $c = $_POST['c'];
$e = $_POST['e']; $e = $_POST['e'];
$d = $_POST['d']; $d = $_POST['d'];
@ -55,7 +55,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong>Modulus (used by both public and private key) </strong> <strong>Modulus (used by both public and private key) </strong>
</td> </td>
<td> <td>
<input type=text name="n" size=120 value="<? echo $n ?>"> <input type=text name="n" size=120 value='<?php echo $n ?>'>
</td> </td>
</tr> </tr>
@ -65,7 +65,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong> e - the public key </strong> <strong> e - the public key </strong>
</td> </td>
<td width> <td width>
<input type=text name="e" size=120 value="<? echo $e ?>"> <input type=text name="e" size=120 value='<?php echo $e ?>'>
</td> </td>
</tr> </tr>
@ -74,12 +74,12 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong> m - the number to encrypt </strong> <strong> m - the number to encrypt </strong>
</td> </td>
<td width> <td width>
<input type=text name="m" size=120 value="<? echo $m ?>"> <input type=text name="m" size=120 value='<?php echo $m ?>'>
</td> </td>
</tr> </tr>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<? echo $phi ?>>
<tr><td><input type="submit" name="submit" value="Encode"> </td></tr> <tr><td><input type="submit" name="submit" value="Encode"> </td></tr>
</table> </table>
@ -88,7 +88,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
</table> </table>
</form> </form>
<? if ( $m ) { ?> <?php if ( $m ) { ?>
<br> <br> <br> <br>
<hr> <hr>
@ -96,7 +96,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<A name="DECODE"> <A name="DECODE">
<hr> <hr>
<? $digits = `./pow_digits $c $d ` ?> <?php $digits = `./pow_digits $c $d ` ?>
<p> <p>
The decoding process calculates the value of c ^ d % n. The decoding process calculates the value of c ^ d % n.
@ -105,10 +105,10 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
The value c ^ d <i> ( <? printf(" %s ^ %s ",$c,$d); ?> ) </i> The value c ^ d <i> ( <? printf(" %s ^ %s ",$c,$d); ?> ) </i>
in this case in this case
would produce a number with approx would produce a number with approx
<b> <? echo $digits ?> </b> decimal digits ! <b> <?php echo $digits ?> </b> decimal digits !
</p> </p>
<? $gt100k = `./gt100k $digits`; <?php $gt100k = `./gt100k $digits`;
if ( $gt100k == 1 ) { ?> if ( $gt100k == 1 ) { ?>
<p> <p>
Obviously this is unacceptable and would cause memory and processing time problems. Obviously this is unacceptable and would cause memory and processing time problems.
@ -117,11 +117,11 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
</p> </p>
<p> Note that for this very large value, <p> Note that for this very large value,
the bc script may take up to the bc script may take up to
<? $mins_est = (($digits/1000000) * ($digits/1000000)) * 1.5; <?php $mins_est = (($digits/1000000) * ($digits/1000000)) * 1.5;
printf("%2.2f",$mins_est); ?> printf("%2.2f",$mins_est); ?>
minutes to finish this calculation. minutes to finish this calculation.
</P> </P>
<? } ?> <?php } ?>
<br> <br>
<form enctype="multipart/form-data" method="post" <form enctype="multipart/form-data" method="post"
action="decode.php"> action="decode.php">
@ -139,7 +139,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong>Modulus (used by both public and private key) </strong> <strong>Modulus (used by both public and private key) </strong>
</td> </td>
<td> <td>
<input type=text name="n" size=120 value="<? echo $n ?>"> <input type=text name="n" size=120 value="<?php echo $n ?>">
</td> </td>
</tr> </tr>
@ -149,7 +149,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong>d - the private key</strong> <strong>d - the private key</strong>
</td> </td>
<td> <td>
<input type=text name="d" size=120 value="<? echo $d ?>" > <input type=text name="d" size=120 value="<?php echo $d ?>" >
</td> </td>
</tr> </tr>
@ -159,36 +159,36 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
<strong> c - the number to de-crypt </strong> <strong> c - the number to de-crypt </strong>
</td> </td>
<td width> <td width>
<input type=text name="c" size=120 value="<? echo $c ?>"> <input type=text name="c" size=120 value="<?php echo $c ?>">
</td> </td>
</tr> </tr>
<input type="hidden" name=digits value=<? echo $digits ?> <input type="hidden" name=digits value=<?php echo $digits ?>
<input type="hidden" name=m value=<? echo $m ?>> <input type="hidden" name=m value=<?php echo $m ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<tr><td><input type="submit" name="submit" value="Decode"> </td></tr> <tr><td><input type="submit" name="submit" value="Decode"> </td></tr>
</table> </table>
</form> </form>
<? } // if to hide decode menu until a value has been coded <?php } // if to hide decode menu until a value has been coded
?> ?>
<form enctype="multipart/form-data" method="post" <form enctype="multipart/form-data" method="post"
action="generate_key.php"> action="generate_key.php">
<input type="hidden" name=digits value=<? echo $digits ?> <input type="hidden" name=digits value=<?php echo $digits ?>
<input type="hidden" name=m value=<? echo $m ?>> <input type="hidden" name=m value=<?php echo $m ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="submit" name="submit" value="Back to Generate Key"> <input type="submit" name="submit" value="Back to Generate Key">
</form> </form>
<? } // all RSA key components defined <?php } // all RSA key components defined
?> ?>
<center> <a href="index.php" border=0> <img src="home.png" border=0> </a> </center> <center> <a href="index.php" border=0> <img src="home.png" border=0> </a> </center>
</body> </body>

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> Find d, the private key </h1> <h1> Find d, the private key </h1>
<? <?php
$e = $_POST['e']; $e = $_POST['e'];
$d = $_POST['d']; $d = $_POST['d'];
$p = $_POST['p']; $p = $_POST['p'];
@ -71,12 +71,12 @@ else {
} }
?> ?>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<table> <table>
<tr> <tr>
<td> <td>

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> Generating PHI the secret Modulus </h1> <h1> Generating PHI the secret Modulus </h1>
<? <?php
$p = $_POST['p']; $p = $_POST['p'];
$q = $_POST['q']; $q = $_POST['q'];
$e = $_POST['e']; $e = $_POST['e'];
@ -34,11 +34,11 @@ printf(" <h2> which is the result of (%s-1)*(%s-1) </h2> \n", $p,$q);
<form enctype="multipart/form-data" method="post" <form enctype="multipart/form-data" method="post"
action="generate_key.php#GCD"> action="generate_key.php#GCD">
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<table> <table>
<tr> <tr>

14
gcd.php
View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> The Numbers </h1> <h1> The Numbers </h1>
<? <?php
$e = $_POST['e']; $e = $_POST['e'];
@ -33,12 +33,12 @@ else {
?> ?>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<table> <table>
<tr><td><input type="submit" name="submit" value="Back"> </td></tr> <tr><td><input type="submit" name="submit" value="Back"> </td></tr>
</table> </table>

View File

@ -42,7 +42,7 @@ For full RSA simulations a <a href="bc.html"> bc </a>
and on-line <a href="bc_primes.php"> here </a>. and on-line <a href="bc_primes.php"> here </a>.
</p> </p>
<? <?php
// for php5 must do this to catch all the variables... // for php5 must do this to catch all the variables...
@ -94,11 +94,11 @@ $mprivate = $_POST['mprivate'];
</td> </td>
</tr> </tr>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>
</table> </table>
@ -132,7 +132,7 @@ Test your values of P and Q here
<strong>Min</strong> <strong>Min</strong>
</td> </td>
<td> <td>
<input type=text name="p" size=120 value="<? echo $p ?>" > <input type=text name="p" size=120 value="<?php echo $p ?>" >
</td> </td>
</tr> </tr>
@ -141,14 +141,14 @@ Test your values of P and Q here
<strong>max</strong> <strong>max</strong>
</td> </td>
<td> <td>
<input type=text name="q" size=120 value="<? echo $q ?>" > <input type=text name="q" size=120 value="<?php echo $q ?>" >
</td> </td>
</tr> </tr>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=mprivate value=<? echo $mprivate ?>> <input type="hidden" name=mprivate value=<?php echo $mprivate ?>>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>
</table> </table>
</form> </form>
@ -177,7 +177,7 @@ When you have chosen your two prime numbers.....we need to find <strong> phi ==
<strong>p</strong> <strong>p</strong>
</td> </td>
<td> <td>
<input type=text name="p" size=120 value="<? echo $p ?>" > <input type=text name="p" size=120 value="<?php echo $p ?>" >
</td> </td>
</tr> </tr>
@ -186,12 +186,12 @@ When you have chosen your two prime numbers.....we need to find <strong> phi ==
<strong>q</strong> <strong>q</strong>
</td> </td>
<td> <td>
<input type=text name="q" size=120 value="<? echo $q ?>" > <input type=text name="q" size=120 value="<?php echo $q ?>" >
</td> </td>
</tr> </tr>
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>
@ -228,7 +228,7 @@ which returns 1 when co-prime values are entered.
<strong>e</strong> <strong>e</strong>
</td> </td>
<td> <td>
<input type=text name="e" size=120 value="<? echo $e ?>"> <input type=text name="e" size=120 value="<?php echo $e ?>">
</td> </td>
</tr> </tr>
@ -237,13 +237,13 @@ which returns 1 when co-prime values are entered.
<strong>phi</strong> <strong>phi</strong>
</td> </td>
<td> <td>
<input type=text name="phi" size=120 value="<? echo $phi ?>"> <input type=text name="phi" size=120 value="<?php echo $phi ?>">
</td> </td>
</tr> </tr>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>
</table> </table>
@ -274,7 +274,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
<strong>d</strong> <strong>d</strong>
</td> </td>
<td> <td>
<input type=text name="d" size=120 value="<? echo $d ?>" > <input type=text name="d" size=120 value="<?php echo $d ?>" >
</td> </td>
</tr> </tr>
@ -283,13 +283,13 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
<strong>phi</strong> <strong>phi</strong>
</td> </td>
<td width> <td width>
<input type=text name="phi" size=120 value="<? echo $phi ?>"> <input type=text name="phi" size=120 value="<?php echo $phi ?>">
</td> </td>
</tr> </tr>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>
</table> </table>
@ -316,7 +316,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
MODULUS (n) MODULUS (n)
</td> </td>
<td> <td>
<? echo $n ?> <?php echo $n ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -325,7 +325,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
</td> </td>
<td> <td>
<? echo $e ?> <?php echo $e ?>
</td> </td>
</tr> </tr>
@ -343,7 +343,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
MODULUS (n) MODULUS (n)
</td> </td>
<td> <td>
<? echo $n ?> <?php echo $n ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -352,7 +352,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
</td> </td>
<td> <td>
<? echo $d ?> <?php echo $d ?>
</td> </td>
</tr> </tr>
@ -377,12 +377,12 @@ the private key.
action="encode_pub.php"> action="encode_pub.php">
<input type="hidden" name=phi value=<? echo $phi ?>> <input type="hidden" name=phi value=<?php echo $phi ?>>
<input type="hidden" name=d value=<? echo $d ?>> <input type="hidden" name=d value=<?php echo $d ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<tr><td><input type="submit" name="submit" value="Encode Using Public Key"> </td></tr> <tr><td><input type="submit" name="submit" value="Encode Using Public Key"> </td></tr>
</table> </table>
</form> </form>

View File

@ -8,6 +8,7 @@
<h1> Web Mastery Course : Assignment Work </h1> <h1> Web Mastery Course : Assignment Work </h1>
<?php echo exec('whoami'); ?>
This web site is a submission for the <b> Web Mastery </b> This web site is a submission for the <b> Web Mastery </b>
course held at Brighton University from the 15th of March to course held at Brighton University from the 15th of March to
the 19th of March 2003. the 19th of March 2003.
@ -35,14 +36,20 @@ private key parts may take several minutes to calculate.
The assignment web application <a href="index.php"> RSA Work Bench / Simulator </a> The assignment web application <a href="index.php"> RSA Work Bench / Simulator </a>
<p> <p>
<hr>
<p>
p.s.
<p>
If this software is installed be sure to chmod +x the sh and bc files.
<hr>
<br> <br>
<br> <br>
<br> <br>
<hr> <hr>
<img SRC="red_bullet_half.gif">Last updated 16Apr2004 <img SRC="blu_bullet_half.gif"> R.P.Clark. <img SRC="red_bullet_half.gif">Last updated 25JAN2016: 16Apr2004 <img SRC="blu_bullet_half.gif"> R.P.Clark.
<hr> <hr>
<?php echo exec('whoami'); ?>
</body> </body>
</html> </html>

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<h1> Public Key 'Modulus' Generation </h1> <h1> Public Key 'Modulus' Generation </h1>
<? <?php
$e = $_POST['e']; $e = $_POST['e'];
$d = $_POST['d']; $d = $_POST['d'];
$p = $_POST['p']; $p = $_POST['p'];
@ -32,10 +32,10 @@ printf(" is capable of encrypting a %s bit length key </h2>",$k-1);
<form enctype="multipart/form-data" method="post" <form enctype="multipart/form-data" method="post"
action="generate_key.php#PHI"> action="generate_key.php#PHI">
<input type="hidden" name=p value=<? echo $p ?>> <input type="hidden" name=p value=<?php echo $p ?>>
<input type="hidden" name=q value=<? echo $q ?>> <input type="hidden" name=q value=<?php echo $q ?>>
<input type="hidden" name=n value=<? echo $n ?>> <input type="hidden" name=n value=<?php echo $n ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<table> <table>
<tr><td><input type="submit" name="submit" value="Back"> </td></tr> <tr><td><input type="submit" name="submit" value="Back"> </td></tr>

2
pi.php
View File

@ -35,7 +35,7 @@ may require a bit of a wait though....
</table> </table>
<input type="hidden" name=luid value=<? echo $luid ?>> <input type="hidden" name=luid value=<?php echo $luid ?>
</form> </form>
<center> <center>

View File

@ -1,7 +1,7 @@
<html> <html>
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f"> <body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
<? <?php
// Find Primes From $i to $x // Find Primes From $i to $x
$x = $_POST['i']; $x = $_POST['i'];
$i = $_POST['x']; $i = $_POST['x'];
@ -63,17 +63,17 @@ else {
<form enctype="multipart/form-data" method="post" <form enctype="multipart/form-data" method="post"
action="generate_key.php#MUL"> action="generate_key.php#MUL">
<input type="hidden" name=m value=<? echo $m ?>> <input type="hidden" name=m value=<?php echo $m ?>>
<input type="hidden" name=e value=<? echo $e ?>> <input type="hidden" name=e value=<?php echo $e ?>>
<input type="hidden" name=npublic value=<? echo $npublic ?>> <input type="hidden" name=npublic value=<?php echo $npublic ?>>
<input type="hidden" name=nprivate value=<? echo $nprivate ?>> <input type="hidden" name=nprivate value=<?php echo $nprivate ?>>
<table> <table>
<tr> <tr>
<td> <td>
<strong>p</strong> <strong>p</strong>
</td> </td>
<td> <td>
<input type=text name="p" cols=80 value="<? echo $p ?>" colspan=2> <input type=text name="p" cols=80 value='<?php echo $p ?>' colspan=2>
</td> </td>
</tr> </tr>
@ -82,7 +82,7 @@ else {
<strong>q</strong> <strong>q</strong>
</td> </td>
<td> <td>
<input type=text name="q" cols=80 value="<? echo $q ?>" colspan=2> <input type=text name="q" cols=80 value='<?php echo $q ?>' colspan=2>
</td> </td>
</tr> </tr>
<tr><td><input type="submit" name="submit" value="Next"> </td></tr> <tr><td><input type="submit" name="submit" value="Next"> </td></tr>