note 21480 deleted from function.mcrypt-decrypt by derick
| From: | derick@php.net | Date: | Fri, 25 Apr 2003 18:32:37 +0000 |
| Subject: | note 21480 deleted from function.mcrypt-decrypt by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47091@lists.php.net to get a copy of this message | ||
here is an example using this function with mode cfb:
function decrypt_normal($key, $c_t)
{
// incoming: should be the $key that you encrypted
// with and the $c_t (encrypted text)
// returns plain text
// decode it first :)
$c_t = trim(chop(base64_decode($c_t)));
/* generate an initialization vector */
$iv = substr(md5($key), 0,mcrypt_get_iv_size (MCRYPT_CAST_256,MCRYPT_MODE_CFB));
/* now we do our normal decrypting */
$p_t = mcrypt_decrypt (MCRYPT_CAST_256, $key, $c_t, "cfb", $iv);
return trim(chop($p_t));
}