Hello,
I'm using ( studying =) ) Phalcon 1.1.0 and according documentation https://media.readthedocs.org/pdf/phalcon-php-framework-documentation/latest/phalcon-php-framework-documentation.pdf Tried to test Encryption functionality and used following code:
$crypt = new \Phalcon\Crypt(); $key = 'le password'; $text = 'This is a secret text'; echo $encrypted = $crypt->encrypt($text,$key); echo $crypt->decrypt($encrypted,$key);
Unfortunatelly it fails with error: Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in \test.php on line 59
Can you tell me in what my mistake or show a working code example.
P.S. I've also tryied following code:
$crypt = new \Phalcon\Crypt();
$crypt->setKey('le password') ->setCipher('cast-256') ->setMode('ofb'); $text = 'This is a secret text'; echo $encrypted = $crypt->encrypt($text); echo $crypt->decrypt($encrypted);
Usually it throw an error: Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in D:\Internet\ext.dev\www\zz-consulting\test.php on line 62
though sometimes success, maybe in 10% of all calls
Thank you.