RSAアルゴリズムの実装(PHP)

昨日の出版物でrunco​​repixxxelのユーザーは、それぞれ単純で信頼性の高い可逆アルゴリズム、具体的にはRSAについての詳細を求めました。 なぜなら 私はかつてこの問題に興味を持ち、同様のアルゴリズムを実装し、そのうちの1つ、RSAメソッドを使用した暗号化のクラスの例、を提供します

実際には理論的な部分がここで見つけることができます 。 私はかつてブルース・シュナイアーの本「Applied Cryptography」を使用していました。

コードを準備するには、次のものが必要です。

1. 高度なユークリッドアルゴリズム
2. GCDを見つけるためのアルゴリズム。
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; } }
  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; } }


クラスの実際の実装は次のとおりです。2つの方法で適用できます

メソッドの回数:

Copy Source | Copy HTML
  1. $ rsa = new CRSA(47、71);
  2. if$ rsa-> initEncryptingKey( 79 ))
  3. {
  4. $ rsa-> EncriptX(「くそー、なんて複雑か」);
  5. echo "\ n" ;
  6. $ rsa-> getDecriptingKey( true );
  7. echo $ rsa-> DecriptX();
  8. echo "\ n" ;
  9. }


メソッド番号2:

Copy Source | Copy HTML
  1. $ rsa = 新しい CRSA();
  2. $ rsa-> EncriptX( "くそー、なんて複雑か、" 79、3337);
  3. echo "\ n" ;
  4. echo $ rsa-> DecriptX(1019、3337);
  5. echo "\ n" ;


謝辞:
記事を公開する機会を与えてくれたユーザーに感謝します。

その他:
ここでこのアルゴリズムの別の実装を見つけることができます

ゼロは、パーサーが食べないように16進数で書き込まれます。

UPD:

コメントで正しく指摘されているように、実装は学術的な関心のためであり、 PHPの既存のデータ型の制限は、深刻なキー長での暗号化を許可しません。

ただし、短期間のセッションデータの暗号化はうまく機能する可能性があります。

UPD 2:

また、実装はここにありますgalaxyユーザーに感謝します)

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


All Articles