Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
06-15-2005, 01:27 PM #1
- Join Date
- Jan 2005
- Thanked 0 Times in 0 Posts
Mcrypt not decrypting the first eight characters
I am using the following to encrypt and decrypt a simple multiline string.
$riv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC);
$riv = mcrypt_create_iv($riv_size, MCRYPT_RAND);
if ($operation == 'decrypt')
$string = rtrim(mcrypt_decrypt(MCRYPT_BLOWFISH, $crypt_key, base64_decode($string), MCRYPT_MODE_CBC, $riv));
elseif ($operation == 'encrypt')
$string = base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, $crypt_key, $string, MCRYPT_MODE_CBC, $riv));
Currently I am having to pad the string with spaces to the left each time to get around this problem and then strip them after decrypting.
Last edited by bauhsoj; 06-16-2005 at 05:47 PM.