📜 ⬆️ ⬇️

Implementation of the RSA (PHP) algorithm

In yesterday's publication , runcore and pixxxel users asked for more information about simple and reliable reversible algorithms and specifically RSA, respectively. Because I once was interested in this issue and implemented similar algorithms, then one of them, an example of a class for encryption using the RSA method, I offer you .

Actually the theoretical part can be found here , in a less accessible form here . I once used Bruce Schneier’s Applied Cryptography.

To prepare the code you will need:
')
1. Advanced Euclidean Algorithm
2. Algorithm of searching GCD.
3. Adapted algorithm of fast number exponentiation

Because the preparatory part is more or less completed, you can go to the implementation.
Next comes the implementation code for the algorithm, with my comments:

Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  1. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  2. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  3. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  4. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  5. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  6. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  7. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  8. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  9. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  10. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  11. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  12. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  13. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  14. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  15. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  16. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  17. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  18. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  19. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  20. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  21. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  22. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  23. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  24. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  25. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  26. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  27. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  28. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  29. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  30. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  31. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  32. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  33. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  34. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  35. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  36. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  37. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  38. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  39. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  40. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  41. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  42. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  43. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  44. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  45. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  46. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  47. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  48. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  49. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  50. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  51. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  52. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  53. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  54. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  55. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  56. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  57. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  58. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  59. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  60. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  61. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  62. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  63. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  64. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  65. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  66. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  67. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  68. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  69. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  70. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  71. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  72. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  73. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  74. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  75. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  76. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  77. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  78. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  79. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  80. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  81. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  82. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  83. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  84. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  85. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  86. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  87. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  88. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  89. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  90. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  91. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  92. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  93. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  94. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  95. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  96. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  97. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  98. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  99. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  100. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  101. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  102. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  103. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  104. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  105. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  106. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  107. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  108. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  109. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  110. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  111. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  112. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  113. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  114. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  115. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  116. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  117. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  118. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  119. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  120. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  121. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  122. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  123. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  124. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  125. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  126. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  127. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  128. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  129. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  130. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  131. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }
  132. Copy Source | Copy HTML class CRSA { // p q private $p =0x0; private $q =0x0; // n(p,q), ph(p,q) private $ph =0x0; private $n =0x0; // private $e =0x0; private $d =0x0; // private $decriptedData = "" ; private $encriptedData = array (); function __construct( $p =0x0, $q =0x0) { $this ->initPQParams( $p , $q ); } // n ph function initPQParams( $p =0x0, $q =0x0) { $this ->p= $p ; $this ->q= $q ; if ( $this ->p && $this ->q && ( $this ->q!= $this ->p)) { $this ->n= $this ->p* $this ->q; $this ->ph=( $this ->p- 1 )*( $this ->q- 1 ); } } // function initEncryptingKey( $e =0x0) { if (! $this ->ph || ! $e ) return false ; $this ->e= $e ; while (! $this ->isMutuallyDistinct( $this ->e, $this ->ph)) $this ->e+= 2 ; return true ; } // private function isMutuallyDistinct( $a , $b ) { while (( $a !=0x0) && ( $b !=0x0)) if ( $a >= $b ) $a = $a % $b ; else $b = $b % $a ; return (( $a + $b )== 1 )? true : false ; } // // function generateDecripringKey() { $u1 = 1 ; $u2 =0x0; $u3 = $this ->ph; $r1 =0x0; $r2 = 1 ; $r3 = $this ->e; while ( $r3 ) { if (! $r3 ) break ; $q =(int)(((int) $u3 )/((int) $r3 )); $t1 =( $u1 - $r1 * $q ); $t2 =( $u2 - $r2 * $q ); $t3 =( $u3 - $r3 * $q ); $u1 = $r1 ; $u2 = $r2 ; $u3 = $r3 ; $r1 = $t1 ; $r2 = $t2 ; $r3 = $t3 ; } $this ->d= $u2 ; } // function getEncripringKey() { return $this ->e; } // function getDecriptingKey( $forced = false ) { if ((! $this ->d) || ( $forced )) { $this ->d=0x0; $this ->generateDecripringKey(); } return $this ->d; } // - , // , - // n(p,q); function EncriptX( $data , $e =0x0, $n =0x0) { if ( $e >0x0 && $n >0x0) { $this ->n= $n ; $this ->e= $e ; } for ( $j =0x0; $j <strlen( $data ); $j ++) { $b =ord( $data [ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->e; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->encriptedData[ $j ]= $result ; } } // - function DecriptX( $d =0x0, $n =0x0) { if ( $d >0x0 && $n >0x0) { $this ->d= $d ; $this ->n= $n ; } $result = 1 ; for ( $j =0x0; $j <count( $this ->encriptedData); $j ++) { $b =( $this ->encriptedData[ $j ]); $result = 1 ; for ( $i =0x0; $i < $this ->d; $i ++) { $result = ( $result * $b ) % $this ->n; } $this ->decriptedData .= chr( $result ); } return $this ->decriptedData; } }


This is actually the release of the class, you can use it in two ways.

Way number one:

Copy Source | Copy HTML
  1. $ rsa = new CRSA ( 47 , 71 );
  2. if ( $ rsa -> initEncryptingKey ( 79 ))
  3. {
  4. $ rsa -> EncriptX (“Damn, how everything is complicated”);
  5. echo "\ n" ;
  6. $ rsa -> getDecriptingKey ( true );
  7. echo $ rsa -> DecriptX ();
  8. echo "\ n" ;
  9. }


Method number two:

Copy Source | Copy HTML
  1. $ rsa = new CRSA ();
  2. $ rsa -> EncriptX ( "Damn, how everything is complicated" , 79 , 3337 );
  3. echo "\ n" ;
  4. echo $ rsa -> DecriptX ( 1019 , 3337 );
  5. echo "\ n" ;


Thanks:
Special thanks to users for the opportunity to publish an article.

Other:
Another implementation of this algorithm can be found here .

The zeros are written in hexadecimal form so that the parser does not eat.

UPD:

As rightly noted in the comments, the implementation is more for academic interest, because existing data type restrictions in PHP do not allow encryption by any serious key length.

But to encrypt short-term session data may well be appropriate.

UPD 2:

Also, the implementation can be found here (ATP. User galaxy )

Source: https://habr.com/ru/post/61400/


All Articles