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:
parent
eeca71b73c
commit
a4b3002f75
@ -1,8 +1,7 @@
|
||||
|
||||
|
||||
# recursive routine to calculate c^d%n
|
||||
# by reaking it down. Works only where
|
||||
# d is a power of 2.
|
||||
# by breaking it down using residues.
|
||||
#
|
||||
define x ( c,d,n) {
|
||||
#-1; d; -1;
|
||||
@ -41,4 +40,3 @@ define t(c,d,n) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> PI - calculated to required precision </h1>
|
||||
<?
|
||||
<?php
|
||||
$e = $_POST['e'];
|
||||
$d = $_POST['d'];
|
||||
$p = $_POST['p'];
|
||||
$n = $_POST['n'];
|
||||
$q = $_POST['q'];
|
||||
$precision = $_POST['precision'];
|
||||
$phi = $_POST['phi'];
|
||||
$mprivate = $_POST['mprivate'];
|
||||
|
||||
@ -21,6 +22,8 @@ printf(" <h2> which is the result of %d decimal places </h2> \n", $precision);
|
||||
$date = `date`;
|
||||
printf(" <p>End Time == %s </p>\n",$date);
|
||||
?>
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
<center>
|
||||
|
38
cbe.sh
38
cbe.sh
@ -2,13 +2,15 @@
|
||||
|
||||
# Calculate large exponent
|
||||
|
||||
#echo "cbe.sh called BASH SCRIPT"
|
||||
|
||||
# php in 'safe mode' (god dag yx skaft)
|
||||
# passes the parameters sent in one string
|
||||
# turning off safe mode in the php.ini file
|
||||
# does not seem to change this behaviour.
|
||||
|
||||
# to overcome this sed will extract the variables
|
||||
#echo $1
|
||||
#echo "argument 1:" $1
|
||||
#
|
||||
c=`echo $1 | sed 's/.*A \([0-9]*\) B.*/\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'`
|
||||
|
||||
#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 "r=1;" >> calc_big_expon.$$.$date.bc
|
||||
echo "t($c,$d,$n);" >> calc_big_expon.$$.$date.bc
|
||||
echo "r;" >> calc_big_expon.$$.$date.bc
|
||||
echo "<br><hr>"
|
||||
echo "created a custom bash script to run to decode using the secret key using residues"
|
||||
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
|
||||
result=`bc < calc_big_expon.$$.$date.bc | tail -1`
|
||||
#echo $args $result
|
||||
echo $result
|
||||
rm -rf calc_big_expon.$$.$date.bc
|
||||
echo "<br><hr>"
|
||||
Use the above bc script to decode the message.
|
||||
echo "<br><hr>"
|
||||
|
30
decode.php
30
decode.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> Encode integer 'm' </h1>
|
||||
<?
|
||||
<?php
|
||||
|
||||
$c = $_POST['c'];
|
||||
$m = $_POST['m'];
|
||||
@ -47,29 +47,31 @@ if ($gt100_k != 1) {
|
||||
echo $clear;
|
||||
}
|
||||
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>";
|
||||
$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`;
|
||||
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\"
|
||||
action=\"encode_pub.php#KEYS\">");
|
||||
?>
|
||||
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=c value=<? echo $c ?>>
|
||||
<input type="hidden" name=m value=<? echo $m ?>>
|
||||
<input type="hidden" name=digits value=<? echo $digits ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=c value=<?php echo $c ?>>
|
||||
<input type="hidden" name=m value=<?php echo $m ?>>
|
||||
<input type="hidden" name=digits value=<?php echo $digits ?>>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
|
18
encode.php
18
encode.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> Encode integer 'm' </h1>
|
||||
<?
|
||||
<?php
|
||||
$e = $_POST['e'];
|
||||
$d = $_POST['d'];
|
||||
$p = $_POST['p'];
|
||||
@ -43,14 +43,14 @@ else {
|
||||
action=\"encode_pub.php#DECODE\">");
|
||||
?>
|
||||
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=c value=<? echo $c ?>>
|
||||
<input type="hidden" name=m value=<? echo $m ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=c value=<?php echo $c ?>>
|
||||
<input type="hidden" name=m value=<?php echo $m ?>>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<h1> RSA Interactive Simulator / Work Bench : Encoding data with the public Key </h1>
|
||||
|
||||
<?
|
||||
<?php
|
||||
$c = $_POST['c'];
|
||||
$e = $_POST['e'];
|
||||
$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>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="n" size=120 value="<? echo $n ?>">
|
||||
<input type=text name="n" size=120 value='<?php echo $n ?>'>
|
||||
</td>
|
||||
</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>
|
||||
</td>
|
||||
<td width>
|
||||
<input type=text name="e" size=120 value="<? echo $e ?>">
|
||||
<input type=text name="e" size=120 value='<?php echo $e ?>'>
|
||||
</td>
|
||||
</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>
|
||||
</td>
|
||||
<td width>
|
||||
<input type=text name="m" size=120 value="<? echo $m ?>">
|
||||
<input type=text name="m" size=120 value='<?php echo $m ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<tr><td><input type="submit" name="submit" value="Encode"> </td></tr>
|
||||
</table>
|
||||
@ -88,7 +88,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<? if ( $m ) { ?>
|
||||
<?php if ( $m ) { ?>
|
||||
|
||||
<br> <br>
|
||||
<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">
|
||||
<hr>
|
||||
|
||||
<? $digits = `./pow_digits $c $d ` ?>
|
||||
<?php $digits = `./pow_digits $c $d ` ?>
|
||||
|
||||
<p>
|
||||
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>
|
||||
in this case
|
||||
would produce a number with approx
|
||||
<b> <? echo $digits ?> </b> decimal digits !
|
||||
<b> <?php echo $digits ?> </b> decimal digits !
|
||||
</p>
|
||||
|
||||
<? $gt100k = `./gt100k $digits`;
|
||||
<?php $gt100k = `./gt100k $digits`;
|
||||
if ( $gt100k == 1 ) { ?>
|
||||
<p>
|
||||
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> Note that for this very large value,
|
||||
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); ?>
|
||||
minutes to finish this calculation.
|
||||
</P>
|
||||
<? } ?>
|
||||
<?php } ?>
|
||||
<br>
|
||||
<form enctype="multipart/form-data" method="post"
|
||||
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>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="n" size=120 value="<? echo $n ?>">
|
||||
<input type=text name="n" size=120 value="<?php echo $n ?>">
|
||||
</td>
|
||||
</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>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="d" size=120 value="<? echo $d ?>" >
|
||||
<input type=text name="d" size=120 value="<?php echo $d ?>" >
|
||||
</td>
|
||||
</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>
|
||||
</td>
|
||||
<td width>
|
||||
<input type=text name="c" size=120 value="<? echo $c ?>">
|
||||
<input type=text name="c" size=120 value="<?php echo $c ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<input type="hidden" name=digits value=<? echo $digits ?>
|
||||
<input type="hidden" name=m value=<? echo $m ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=digits value=<?php echo $digits ?>
|
||||
<input type="hidden" name=m value=<?php echo $m ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<tr><td><input type="submit" name="submit" value="Decode"> </td></tr>
|
||||
</table>
|
||||
|
||||
</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"
|
||||
action="generate_key.php">
|
||||
<input type="hidden" name=digits value=<? echo $digits ?>
|
||||
<input type="hidden" name=m value=<? echo $m ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=digits value=<?php echo $digits ?>
|
||||
<input type="hidden" name=m value=<?php echo $m ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="submit" name="submit" value="Back to Generate Key">
|
||||
</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>
|
||||
</body>
|
||||
|
14
find_d.php
14
find_d.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> Find d, the private key </h1>
|
||||
<?
|
||||
<?php
|
||||
$e = $_POST['e'];
|
||||
$d = $_POST['d'];
|
||||
$p = $_POST['p'];
|
||||
@ -71,12 +71,12 @@ else {
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
|
12
find_phi.php
12
find_phi.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> Generating PHI the secret Modulus </h1>
|
||||
<?
|
||||
<?php
|
||||
$p = $_POST['p'];
|
||||
$q = $_POST['q'];
|
||||
$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"
|
||||
action="generate_key.php#GCD">
|
||||
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
14
gcd.php
14
gcd.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> The Numbers </h1>
|
||||
<?
|
||||
<?php
|
||||
|
||||
|
||||
$e = $_POST['e'];
|
||||
@ -33,12 +33,12 @@ else {
|
||||
?>
|
||||
|
||||
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<table>
|
||||
<tr><td><input type="submit" name="submit" value="Back"> </td></tr>
|
||||
</table>
|
||||
|
@ -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>.
|
||||
</p>
|
||||
|
||||
<?
|
||||
<?php
|
||||
|
||||
// for php5 must do this to catch all the variables...
|
||||
|
||||
@ -94,11 +94,11 @@ $mprivate = $_POST['mprivate'];
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
|
||||
<tr><td><input type="submit" name="submit" value="Next"> </td></tr>
|
||||
</table>
|
||||
@ -132,7 +132,7 @@ Test your values of P and Q here
|
||||
<strong>Min</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="p" size=120 value="<? echo $p ?>" >
|
||||
<input type=text name="p" size=120 value="<?php echo $p ?>" >
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -141,14 +141,14 @@ Test your values of P and Q here
|
||||
<strong>max</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="q" size=120 value="<? echo $q ?>" >
|
||||
<input type=text name="q" size=120 value="<?php echo $q ?>" >
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=mprivate value=<? echo $mprivate ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=mprivate value=<?php echo $mprivate ?>>
|
||||
<tr><td><input type="submit" name="submit" value="Next"> </td></tr>
|
||||
</table>
|
||||
</form>
|
||||
@ -177,7 +177,7 @@ When you have chosen your two prime numbers.....we need to find <strong> phi ==
|
||||
<strong>p</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="p" size=120 value="<? echo $p ?>" >
|
||||
<input type=text name="p" size=120 value="<?php echo $p ?>" >
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -186,12 +186,12 @@ When you have chosen your two prime numbers.....we need to find <strong> phi ==
|
||||
<strong>q</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="q" size=120 value="<? echo $q ?>" >
|
||||
<input type=text name="q" size=120 value="<?php echo $q ?>" >
|
||||
</td>
|
||||
</tr>
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
|
||||
|
||||
<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>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="e" size=120 value="<? echo $e ?>">
|
||||
<input type=text name="e" size=120 value="<?php echo $e ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -237,13 +237,13 @@ which returns 1 when co-prime values are entered.
|
||||
<strong>phi</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="phi" size=120 value="<? echo $phi ?>">
|
||||
<input type=text name="phi" size=120 value="<?php echo $phi ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
|
||||
<tr><td><input type="submit" name="submit" value="Next"> </td></tr>
|
||||
</table>
|
||||
@ -274,7 +274,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
<strong>d</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name="d" size=120 value="<? echo $d ?>" >
|
||||
<input type=text name="d" size=120 value="<?php echo $d ?>" >
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -283,13 +283,13 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
<strong>phi</strong>
|
||||
</td>
|
||||
<td width>
|
||||
<input type=text name="phi" size=120 value="<? echo $phi ?>">
|
||||
<input type=text name="phi" size=120 value="<?php echo $phi ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<tr><td><input type="submit" name="submit" value="Next"> </td></tr>
|
||||
</table>
|
||||
|
||||
@ -316,7 +316,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
MODULUS (n)
|
||||
</td>
|
||||
<td>
|
||||
<? echo $n ?>
|
||||
<?php echo $n ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -325,7 +325,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<? echo $e ?>
|
||||
<?php echo $e ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -343,7 +343,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
MODULUS (n)
|
||||
</td>
|
||||
<td>
|
||||
<? echo $n ?>
|
||||
<?php echo $n ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -352,7 +352,7 @@ Note on the algorithm used are <a href="find_d.html"> here </a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<? echo $d ?>
|
||||
<?php echo $d ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -377,12 +377,12 @@ the private key.
|
||||
action="encode_pub.php">
|
||||
|
||||
|
||||
<input type="hidden" name=phi value=<? echo $phi ?>>
|
||||
<input type="hidden" name=d value=<? echo $d ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=phi value=<?php echo $phi ?>>
|
||||
<input type="hidden" name=d value=<?php echo $d ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<tr><td><input type="submit" name="submit" value="Encode Using Public Key"> </td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
11
index.html
11
index.html
@ -8,6 +8,7 @@
|
||||
|
||||
<h1> Web Mastery Course : Assignment Work </h1>
|
||||
|
||||
<?php echo exec('whoami'); ?>
|
||||
This web site is a submission for the <b> Web Mastery </b>
|
||||
course held at Brighton University from the 15th of March to
|
||||
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>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<?php echo exec('whoami'); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
10
multiply.php
10
multiply.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
<h1> Public Key 'Modulus' Generation </h1>
|
||||
<?
|
||||
<?php
|
||||
$e = $_POST['e'];
|
||||
$d = $_POST['d'];
|
||||
$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"
|
||||
action="generate_key.php#PHI">
|
||||
|
||||
<input type="hidden" name=p value=<? echo $p ?>>
|
||||
<input type="hidden" name=q value=<? echo $q ?>>
|
||||
<input type="hidden" name=n value=<? echo $n ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=p value=<?php echo $p ?>>
|
||||
<input type="hidden" name=q value=<?php echo $q ?>>
|
||||
<input type="hidden" name=n value=<?php echo $n ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
|
||||
<table>
|
||||
<tr><td><input type="submit" name="submit" value="Back"> </td></tr>
|
||||
|
2
pi.php
2
pi.php
@ -35,7 +35,7 @@ may require a bit of a wait though....
|
||||
</table>
|
||||
|
||||
|
||||
<input type="hidden" name=luid value=<? echo $luid ?>>
|
||||
<input type="hidden" name=luid value=<?php echo $luid ?>
|
||||
</form>
|
||||
|
||||
<center>
|
||||
|
14
primes.php
14
primes.php
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
||||
|
||||
<?
|
||||
<?php
|
||||
// Find Primes From $i to $x
|
||||
$x = $_POST['i'];
|
||||
$i = $_POST['x'];
|
||||
@ -63,17 +63,17 @@ else {
|
||||
<form enctype="multipart/form-data" method="post"
|
||||
action="generate_key.php#MUL">
|
||||
|
||||
<input type="hidden" name=m value=<? echo $m ?>>
|
||||
<input type="hidden" name=e value=<? echo $e ?>>
|
||||
<input type="hidden" name=npublic value=<? echo $npublic ?>>
|
||||
<input type="hidden" name=nprivate value=<? echo $nprivate ?>>
|
||||
<input type="hidden" name=m value=<?php echo $m ?>>
|
||||
<input type="hidden" name=e value=<?php echo $e ?>>
|
||||
<input type="hidden" name=npublic value=<?php echo $npublic ?>>
|
||||
<input type="hidden" name=nprivate value=<?php echo $nprivate ?>>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>p</strong>
|
||||
</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>
|
||||
</tr>
|
||||
|
||||
@ -82,7 +82,7 @@ else {
|
||||
<strong>q</strong>
|
||||
</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>
|
||||
</tr>
|
||||
<tr><td><input type="submit" name="submit" value="Next"> </td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user