CodeIgniter Forums
Encrypt is not working. Why? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Encrypt is not working. Why? (/showthread.php?tid=56105)



Encrypt is not working. Why? - El Forum - 11-27-2012

[eluser]indapublic[/eluser]
Code:

Code:
$msg = 'My secret message';
$key = 'super-secret-key';

$this->load->library('encrypt');

$encrypted_string = $this->encrypt->encode($msg, $key);

echo "<br>encrypted_string: ";
echo $encrypted_string;

$plaintext_string = $this->encrypt->decode($encrypted_string, $key);

echo "<br>plaintext_string: ";
echo $plaintext_string;

Output:

Quote:encrypted_string: z6av2ITojqUzAgrPNlcaqqC4Evq30Z4Y6GZjfQDjHvgh+fe7e1ybLolTPQzmlXxnapVs7EnN5I1xPv8YT6h6iw==
plaintext_string:

phpinfo() output:

Quote:mcrypt

mcrypt support enabled
mcrypt_filter support enabled
Version 2.5.8
Api No 20021217
Supported ciphers cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes cbc cfb ctr ecb ncfb nofb ofb stream

Directive Local Value Master Value
mcrypt.algorithms_dir no value no value
mcrypt.modes_dir no value no value



Encrypt is not working. Why? - El Forum - 12-01-2012

[eluser]predat0r[/eluser]
I copy/pasted your code into my dev environment , and it's perfectly working. CI v2.1.3
Try it on a new, clean CI installation.