-
-
- /**
- * mcrypt加密与解密
- * by bbs.it-home.org
- */
- $data = 'data';
- $key = "key";
$algorithm = MCRYPT_BLOWFISH;
- $mode = MCRYPT_MODE_CBC;
- $iv = mcrypt_create_iv(mcrypt_get_iv_size($algorithm,$mode), MCRYPT_DEV_URANDOM);
$encrypted_data = mcrypt_encrypt($algorithm, $key, $data, $mode, $iv);
$decrypted_data = mcrypt_decrypt($algorithm, $key, $encrypted_data, $mode, $iv);
print "解密数据为:$decrypted_data";
- ?>
-
复制代码
|