note 100776 deleted from function.mcrypt-create-iv by danbrown
| From: | danbrown@php.net | Date: | Fri, 05 Nov 2010 18:06:55 +0000 |
| Subject: | note 100776 deleted from function.mcrypt-create-iv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173791@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "a9a8f7a6ca9a0gh7a6a5sf";
function encriptar($text){
global $iv;
global $key;
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_ECB, $iv);
return base64_encode($crypttext);
}
function desencriptar($text){
global $iv;
global $key;
$text = base64_decode($text);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_ECB, $iv);
return rtrim($decrypttext,"\0\4");
}