Mcrypt 支锟斤拷使锟斤拷锟斤拷锟斤拷锟斤拷锟姐法锟斤拷锟斤拷锟叫硷拷锟杰和斤拷锟杰★拷
锟斤拷锟斤拷锟绞癸拷锟� libmcrypt-2.2.x 锟斤拷锟接憋拷锟斤拷 PHP锟斤拷
通锟斤拷使锟斤拷锟斤拷锟斤拷要锟斤拷锟侥革拷锟斤拷锟斤拷锟斤拷mcrypt_cfb()锟斤拷
mcrypt_cbc(), mcrypt_ecb()锟斤拷
锟斤拷 mcrypt_ofb()锟斤拷
锟皆硷拷 MCRYPT_ENCRYPT
and
MCRYPT_DECRYPT
锟斤拷锟斤拷锟斤拷锟捷斤拷锟叫加斤拷锟杰★拷
锟斤拷锟斤拷锟绞癸拷锟� libmcrypt 2.4.x 锟斤拷锟斤拷 2.5.x 锟芥本锟斤拷锟斤拷锟较猴拷锟斤拷锟斤拷然锟斤拷锟矫★拷 锟斤拷锟角斤拷锟斤拷使锟斤拷锟铰版本锟结供锟侥革拷锟饺斤拷锟侥猴拷锟斤拷锟斤拷
Example #1 锟斤拷 2.4.x 锟斤拷锟斤拷甙姹撅拷锟绞癸拷锟� 256 锟斤拷锟截碉拷锟斤拷钥锟斤拷AES 锟姐法锟斤拷 CBC 模式锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
<?php
$key = hash('sha256', 'this is a secret key', true);
$input = "Let us meet at 9 o'clock at the secret place.";
$td = mcrypt_module_open('rijndael-128', '', 'cbc', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_URANDOM);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
?>