note 108668 rejected from function.mcrypt-encrypt by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 May 2012 13:44:12 +0000 |
| Subject: | note 108668 rejected from function.mcrypt-encrypt by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188012@lists.php.net to get a copy of this message | ||
Note Submitter: anupamchakma at gmail dot com
----
below is my encryption function, it is working well with php5.3 but when i try to use the same in
php5.1, it doesnt work the program terminates before encrypting...Its neither giving a syntax error
while compiling...please suggest where i am going wrong.....
function encrypt($string)
{
//Key
$key = "xxxxxxxx";
//Encryption
$cipher_alg = MCRYPT_DES; //MCRYPT_TRIPLEDES;
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg,MCRYPT_MODE_ECB), MCRYPT_RAND);
$encrypted_string = mcrypt_encrypt($cipher_alg, $key, $string, MCRYPT_MODE_ECB, $iv);
return base64_encode($encrypted_string);
return $encrypted_string;
}