harsha
harsha

Reputation: 13

base64_encode not working and not throwing errors

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))) ;

I am using the above line to encrypt a string. But some how it is not working. The same code works fine on my pc (i am using wamp server). The problem shows up only when i put it on my linux server which is running php 5.3.27. It does not throw up any errors. The rest of the script after this line is not executed. I commented out this line and the whole script executed perfectly.

Upvotes: 0

Views: 497

Answers (1)

Joran Den Houting
Joran Den Houting

Reputation: 3163

Maybe remove the space between ) and ;

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

Works fine for me like this:

$key = "testkey";
$test = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

echo $test;

Upvotes: 1

Related Questions