made it create a bc script for larger keys (rather thn make the web page wait for the long calculations).
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<html>
|
|
<body BGCOLOR="#00E0E0" link="#001fC0" vlink="#000080" text="#00000f">
|
|
<h1> The Numbers </h1>
|
|
<?php
|
|
|
|
|
|
$e = $_POST['e'];
|
|
$d = $_POST['d'];
|
|
$p = $_POST['p'];
|
|
$n = $_POST['n'];
|
|
$q = $_POST['q'];
|
|
$phi = $_POST['phi'];
|
|
$mprivate = $_POST['mprivate'];
|
|
|
|
|
|
|
|
//echo " gcd($e,$phi) == ";
|
|
|
|
$big_num = `echo "a=$e; b=$phi; while(b) {a=a%b; r=b; b=a; a=r;}; a;" | bc `;
|
|
|
|
printf(" <h2> gcd($e,$phi) == %s </h2>",$big_num);
|
|
|
|
if ($big_num == 1) {
|
|
printf("<h2>So these numbers are co-prime</h2><h2> the value for e is therefore acceptable </h2>\n");
|
|
printf("<form enctype=\"multipart/form-data\" method=\"post\" action=\"generate_key.php#D\">");
|
|
}
|
|
else {
|
|
printf("<h1>e is not coprime to M</h1><h1> go back and try another value for e</h1>\n");
|
|
printf("<form enctype=\"multipart/form-data\" method=\"post\" action=\"generate_key.php#GCD\">");
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|