以下为引用的内容: blowfish rc2 safer-sk64 xtea cast-256 rc4 safer-sk128 des rc4-iv serpent enigma rijndael-128 threeway gost rijndael-192 tripledes loki97 rijndael-256 twofish panamasaferplus wake |
如何安装mcrypt?
在标准的php软件包中不包括mcrypt,因此需要下载它,下载的地址为:ftp://argeas.cs-net.gr/pub/unix/mcrypt/ 。下载后,按照下面的方法进行编译,并把它扩充在php中:
下载mcrypt软件包。
以下为引用的内容: gunzipmcrypt-x.x.x.tar.gz tar -xvfmcrypt-x.x.x.tar ./configure --disable-posix-threads make make install cd to your php directory. ./configure -with-mcrypt=[dir] [--other-configuration-directives] make make install |
以下为引用的内容: <?php // designate string to be encrypted $string = "applied cryptography, by bruce schneier, is a wonderful cryptography reference."; // encryption/decryption key $key = "four score and twenty years ago"; // encryption algorithm $cipher_alg = mcrypt_rijndael_128; // create the initialization vector for added security. $iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg, mcrypt_mode_ecb), mcrypt_rand); // output original string print "original string: $string "; // encrypt $string $encrypted_string = mcrypt_encrypt($cipher_alg, $key, $string, mcrypt_mode_cbc, $iv); // convert to hexadecimal and output to browser print "encrypted string: ".bin2hex($encrypted_string)." "; $decrypted_string = mcrypt_decrypt($cipher_alg, $key, $encrypted_string, mcrypt_mode_cbc, $iv); print "decrypted string: $decrypted_string"; ?> |
以下为引用的内容: original string: applied cryptography, by bruce schneier, is a wonderful cryptography reference. encrypted string: 02a7c58b1ebd22a9523468694b091e60411cc4dea8652bb8072 34fa06bbfb20e71ecf525f29df58e28f3d9bf541f7ebcecf62b c89fde4d8e7ba1e6cc9ea24850478c11742f5cfa1d23fe22fe8 bfbab5e decrypted string: applied cryptography, by bruce schneier, is a wonderful cryptography reference. |
新闻热点
疑难解答