RSA Encryption process in PHP -
in effort understand asymmetric encryption process outlined simple php script encrypt , decrypt simple numbers. noticed after while given numbers encrypt/decrypt algorithm fail, in decrypted , initial numbers didn't match. put loop in see how algorithm perform when ecrypting , decrypting 100 numbers , after number 32 process fell apart. is because p*q = 33? <?php # test encrypto algo // choose prime keys $p = 47; $q = 71; // compute n = pq $n = $p*$q; // choose e such 1 < e < f(n) , e , n coprime $e = 79; // compute value d such (d * e) % f(n) = 1 $d = 1019; // compute f(n) = (p-1)(q-1) $z = ($p - 1)*($q - 1); // create public , private keys $pubk = array('n' => $n, 'e' => $e); $privk = array('n'=> $n, 'd' => $d); // boundary loop $l = 100; // perform encypt/decrypt on 1..100 for($i = 1; $i <= $l; $i++) { $enc = enc($i, $pubk); $dec = dec($enc, $privk); print "encrypted <b>$i</b> = $enc...