[snip]
I am encrypting some data on one server and now I am attempting to decrypt on another 
server using mcrypt_encrypt and mycrypt_decrypt (using same key and initialzation 
vector). It is almost working but I seem to still have a little problem, that data is 
missing the last character which still seems to be encrypted. I am putting the data in 
the database with addslashes, and retrieving with stripslashes, but I get things like 
this;

45221141¤Þ,]¹9Ñ
77777775ÿåZ|z

while($arrEncInfo = mysql_fetch_array($dbGetSub)){
        $stripDataA = stripslashes($arrEncInfo['dataA']);
        $stripIV = stripslashes($arrEncInfo['iv']);
        $dataA = mcrypt_decrypt($encAlg, $encKey, $stripDataA, $encMode, $stripIV);
        echo $dataA . "\n";
}       

Has anyone seen this? Could there be a difference between the PHP installs? Both are 
version 4.3.7.
[/snip]

I found the problem on the field in question. I had left the column in the database 
the same length as it was prior to encrypting the data. This, as it turns out, is a 
BAD THING [tm]. Make sure that database columns are large enough to hold the whole of 
the encrypted data.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to