From 1fe3879dd286d15b918f369f1a3902dc8183c950 Mon Sep 17 00:00:00 2001 From: robin Date: Fri, 17 Feb 2012 13:18:51 +0000 Subject: [PATCH] modified to work with php5 --- calc_big_num.php | 9 +++++++++ calc_pi.php | 7 +++++++ cbe.php | 9 +++++++++ decode.php | 13 +++++++++++++ encode.php | 10 ++++++++++ encode_pub.php | 12 ++++++++++++ find_d.php | 11 +++++++++++ find_phi.php | 10 ++++++++++ gcd.php | 12 ++++++++++++ generate_key.php | 20 ++++++++++++++++++++ multiply.php | 15 +++++++++++++-- primes.php | 17 +++++++++++++++++ 12 files changed, 143 insertions(+), 2 deletions(-) diff --git a/calc_big_num.php b/calc_big_num.php index 2d5ffa1..3aa7431 100644 --- a/calc_big_num.php +++ b/calc_big_num.php @@ -2,6 +2,15 @@

The Numbers

PI - calculated to required precision

"; echo `echo " a(1)*4" | bc -l `; echo "A

"; diff --git a/decode.php b/decode.php index 56b834b..640c4cb 100644 --- a/decode.php +++ b/decode.php @@ -2,6 +2,19 @@

Encode integer 'm'

Decodes the ciphered integer using the secret 'd' key : m = c^d mod n. \n"; //echo "d == $d

"; diff --git a/encode.php b/encode.php index 273706b..edd0ec4 100644 --- a/encode.php +++ b/encode.php @@ -2,6 +2,16 @@

Encode integer 'm'

in encode.php m is $m"; echo "

Computes the cipher text c = m^e mod n.

"; echo "

$m^$e%$n

"; $digits = `./pow_digits $m $e`; diff --git a/encode_pub.php b/encode_pub.php index 69b98ff..92755e5 100644 --- a/encode_pub.php +++ b/encode_pub.php @@ -6,6 +6,18 @@

RSA Interactive Simulator / Work Bench : Encoding data with the public Key

in encode_pup.php m is %s ",$m); If ( $n < 1 || $e < 1 || $d < 1 ) { diff --git a/find_d.php b/find_d.php index 1711243..98e453d 100644 --- a/find_d.php +++ b/find_d.php @@ -2,6 +2,17 @@

Find d, the private key

PHI is %s",$phi); //echo "debug n==$n"; diff --git a/find_phi.php b/find_phi.php index 6cca28b..0b30d54 100644 --- a/find_phi.php +++ b/find_phi.php @@ -2,6 +2,16 @@

Generating PHI the secret Modulus

The Numbers

bc and on-line here .

+ + +


FIND SUITABLE PRIMES

diff --git a/multiply.php b/multiply.php index 2bc4a13..e6f16c2 100644 --- a/multiply.php +++ b/multiply.php @@ -1,9 +1,18 @@ - -

Public Key 'Modulus' Generation

",$k-1);
+ > > > > +
diff --git a/primes.php b/primes.php index b110041..89c12a8 100644 --- a/primes.php +++ b/primes.php @@ -3,7 +3,24 @@ ",$i,$x); +//printf(" i is %d x is %d
",$i,$x); +//printf(" i is %d x is %d
",$i,$x); +//rintf(" i is %d x is %d
",$i,$x); // if they put they parameters the wrong way round...