Encrypt then decrypt yields extra dots at end
| From: | Kelly Jones | Date: | Mon, 07 Sep 2009 17:00:10 +0000 |
| Subject: | Encrypt then decrypt yields extra dots at end | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-297762@lists.php.net to get a copy of this message | ||
I thought this code:
$enc=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123","encrypt_me",MCRYPT_ENCRYPT);
$dec=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123",$enc,MCRYPT_DECRYPT);
echo $dec;
would yield "encrypt_me". The actual result is
"encrypt_me......................" (bunch of extra dots).
Why, and how do I fix it?
Does it have something to do w/ the warning I get:
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty
IV, which is NOT recommend
I assumed that was a security warning, not a functionality warnings?
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.