CodeIgniter Forums
CI 1.7. Encrypt class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI 1.7. Encrypt class (/showthread.php?tid=12684)



CI 1.7. Encrypt class - El Forum - 10-27-2008

[eluser]Unknown[/eluser]
I have problem with Encrypt class

i try to encode string, with cipher BLOWFISH

my code:
Code:
$this->load->library("encrypt");
$this->encrypt->set_cipher('MCRYPT_BLOWFISH');
echo "Secret : ".$this->encrypt->encode("secret");

my result:
Code:
A PHP Error was encountered
Severity: Warning
Message: mcrypt_get_iv_size() [function.mcrypt-get-iv-size]: Module initialization failed
Filename: libraries/Encrypt.php
Line Number: 256

A PHP Error was encountered
Severity: Warning
Message: mcrypt_create_iv() [function.mcrypt-create-iv]: Can not create an IV with a size of less then 1 or greater then 2147483647
Filename: libraries/Encrypt.php
Line Number: 257

A PHP Error was encountered
Severity: Warning
Message: mcrypt_encrypt() [function.mcrypt-encrypt]: Module initialization failed
Filename: libraries/Encrypt.php
Line Number: 258

Tested mcrypt
Code:
echo ( ! function_exists('mcrypt_encrypt')) ? 'Nope' : 'Yup';
it works.

Tested crypt
Code:
echo crypt("secret", 'BLOWFISH');
it works to.


CI 1.7. Encrypt class - El Forum - 10-28-2008

[eluser]Pascal Kriete[/eluser]
The available mcrypt cyphers are constants:
Code:
$this->encrypt->set_cipher(MCRYPT_BLOWFISH);



CI 1.7. Encrypt class - El Forum - 10-28-2008

[eluser]Unknown[/eluser]
works! Thanks!