PHP/XML/mcrypt encrypt
Версия от 10:37, 26 мая 2010; (обсуждение)
Encrypting and decrypting with mcrypt
<?
$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 "The decoded data is $decrypted_data";
?>