note 21480 added to function.mcrypt-decrypt
| From: | fandelem at hotmail dot com | Date: | Tue, 14 May 2002 18:01:55 +0000 |
| Subject: | note 21480 added to function.mcrypt-decrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30639@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));
}
--
http://www.php.net/manual/en/function.mcrypt-decrypt.php
http://master.php.net/manage/user-notes.php?action=edit+21480
http://master.php.net/manage/user-notes.php?action=delete+21480
http://master.php.net/manage/user-notes.php?action=reject+21480