diff --git a/calc_big_expon.bc b/calc_big_expon.bc index 371f0d0..a78230f 100644 --- a/calc_big_expon.bc +++ b/calc_big_expon.bc @@ -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) { } } - diff --git a/calc_pi.php b/calc_pi.php index d75eefc..b8123ba 100644 --- a/calc_pi.php +++ b/calc_pi.php @@ -1,12 +1,13 @@

PI - calculated to required precision

- which is the result of %d decimal places \n", $precision); $date = `date`; printf("

End Time == %s

\n",$date); ?> + +

diff --git a/cbe.sh b/cbe.sh index 25d02b5..6794592 100755 --- a/cbe.sh +++ b/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 "

c " $c " d " $d " n " $n "

"` date=`date | sed 's\:\_\g' | sed 's\ \_\g'` -#echo $date +echo "date on this server" $date + +echo "

" + -# 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 "

" +echo "created a custom bash script to run to decode using the secret key using residues" +echo "

" +echo " custom bc script produced " +echo "
"
+cat calc_big_expon.bc 
+echo "r=1;"        
+echo "t($c,$d,$n);"
+echo "r;"
+echo "
" -#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 "

" +Use the above bc script to decode the message. +echo "

" diff --git a/decode.php b/decode.php index 640c4cb..1ef05f2 100644 --- a/decode.php +++ b/decode.php @@ -1,7 +1,7 @@

Encode integer 'm'

- The number of digits produced by the exponentiation of c^d is greater than 100,0000 "; + echo "

The number of digits produced by the exponentiation of c^d is greater than 100,000

"; echo "

The resursive (see recursive exponentiation break down ) routines will be applied instead to calculate c^d%n

"; $clear = `./cbe.sh 'A $c B $d C $n D'`; // php is very nasty about sending multiple args to scripts - echo "

this gives the 'in clear' result

"; - echo $clear; + echo $clear; + echo "

The resursive routines can take some time to run, too long to leave a web page waitng!

"; + echo "

If you don't have `bc' on your system, grow up and get a proper operating system.

"; } +$me = `whoami`; $date = `date`; -printf("

End Time == %s

\n",$date); +printf("

End Time == %s me=%s

\n",$date,$me); printf("
"); ?> -> -> -> -> -> -> -> -> -> +> +> +> +> +> +> +> +> +>
diff --git a/encode.php b/encode.php index edd0ec4..aabf31a 100644 --- a/encode.php +++ b/encode.php @@ -1,7 +1,7 @@

Encode integer 'm'

-"); ?> -> -> -> -> -> -> -> -> +> +> +> +> +> +> +> +> @@ -65,7 +65,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q). e - the public key @@ -74,12 +74,12 @@ to the power of e, and then applying the modulus for n (i.e. p times q). m - the number to encrypt -> -> -> +> +> +> >
diff --git a/encode_pub.php b/encode_pub.php index 92755e5..58da677 100644 --- a/encode_pub.php +++ b/encode_pub.php @@ -5,7 +5,7 @@

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

-Modulus (used by both public and private key)
- +
- +
- +
@@ -88,7 +88,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
- +


@@ -96,7 +96,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q).
- +

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 ( ) in this case would produce a number with approx - decimal digits ! + decimal digits !

-

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).

Note that for this very large value, the bc script may take up to - minutes to finish this calculation.

- +
@@ -139,7 +139,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q). Modulus (used by both public and private key) - + @@ -149,7 +149,7 @@ to the power of e, and then applying the modulus for n (i.e. p times q). d - the private key - + @@ -159,36 +159,36 @@ to the power of e, and then applying the modulus for n (i.e. p times q). c - the number to de-crypt - + - - > - > - > + + > + > + >
-
- -> -> -> -> -> + +> +> +> +> +>
-
diff --git a/find_d.php b/find_d.php index 98e453d..d013f87 100644 --- a/find_d.php +++ b/find_d.php @@ -1,7 +1,7 @@

Find d, the private key

- -> -> -> -> -> -> +> +> +> +> +> +> - > - > - > - > - > + > + > + > + > + >
diff --git a/find_phi.php b/find_phi.php index 0b30d54..db1e1da 100644 --- a/find_phi.php +++ b/find_phi.php @@ -1,7 +1,7 @@

Generating PHI the secret Modulus

- which is the result of (%s-1)*(%s-1) \n", $p,$q);
-> -> -> -> -> +> +> +> +> +> diff --git a/gcd.php b/gcd.php index 477d41d..a37302c 100644 --- a/gcd.php +++ b/gcd.php @@ -1,7 +1,7 @@

The Numbers

- - > - > - > - > - > - > + > + > + > + > + > + >
diff --git a/generate_key.php b/generate_key.php index d8010a5..56f3d8e 100644 --- a/generate_key.php +++ b/generate_key.php @@ -42,7 +42,7 @@ For full RSA simulations a bc and on-line here .

-
@@ -132,7 +132,7 @@ Test your values of P and Q here Min - + @@ -141,14 +141,14 @@ Test your values of P and Q here max - + -> -> -> -> +> +> +> +> @@ -177,7 +177,7 @@ When you have chosen your two prime numbers.....we need to find phi == p - + @@ -186,12 +186,12 @@ When you have chosen your two prime numbers.....we need to find phi == q - + -> -> -> +> +> +> @@ -228,7 +228,7 @@ which returns 1 when co-prime values are entered. e - + @@ -237,13 +237,13 @@ which returns 1 when co-prime values are entered. phi - + -> -> -> +> +> +> @@ -274,7 +274,7 @@ Note on the algorithm used are here d - + @@ -283,13 +283,13 @@ Note on the algorithm used are here phi - + -> -> -> -> +> +> +> +> @@ -316,7 +316,7 @@ Note on the algorithm used are here MODULUS (n) - + @@ -325,7 +325,7 @@ Note on the algorithm used are here - + @@ -343,7 +343,7 @@ Note on the algorithm used are here MODULUS (n) - + @@ -352,7 +352,7 @@ Note on the algorithm used are here - + @@ -377,12 +377,12 @@ the private key. action="encode_pub.php"> - > - > - > - > - > - > + > + > + > + > + > + > diff --git a/index.html b/index.html index d3fbb08..ba0034a 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@

Web Mastery Course : Assignment Work

+ This web site is a submission for the Web Mastery 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 RSA Work Bench / Simulator

- +


+

+p.s. +

+If this software is installed be sure to chmod +x the sh and bc files. +






-Last updated 16Apr2004 R.P.Clark. +Last updated 25JAN2016: 16Apr2004 R.P.Clark.
+ diff --git a/multiply.php b/multiply.php index e6f16c2..c2243d4 100644 --- a/multiply.php +++ b/multiply.php @@ -1,7 +1,7 @@

Public Key 'Modulus' Generation

-",$k-1);
- > - > - > - > + > + > + > + > diff --git a/pi.php b/pi.php index 54ba7b7..a6cef02 100644 --- a/pi.php +++ b/pi.php @@ -35,7 +35,7 @@ may require a bit of a wait though....
-> +
diff --git a/primes.php b/primes.php index 89c12a8..05d9df9 100644 --- a/primes.php +++ b/primes.php @@ -1,7 +1,7 @@ - - > - > - > - > + > + > + > + > @@ -82,7 +82,7 @@ else { q
p - +
- +