tutorialstuff Posted December 22, 2009 Share Posted December 22, 2009 This seems to work fine in IE8, but whenever I view it in FF3, There is some weird trailing characters after the decrypted text. $decryption_key = "Yru8S09edICE"; $cipher_alg=MCRYPT_RIJNDAEL_256; function hex2bin($data) { $len = strlen($data); return pack("H" . $len, $data); } $iv = bin2hex(mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg, MCRYPT_MODE_CBC), MCRYPT_RAND)); $encryppted_text = mcrypt_encrypt($cipher_alg, $decryption_key, 'this is text', MCRYPT_MODE_CBC, hex2bin($iv)); print $encryppted_text."<br />"; $decrypted_text = mcrypt_decrypt($cipher_alg, $decryption_key, $encryppted_text, MCRYPT_MODE_CBC, hex2bin($iv)); print $decrypted_text; Quote Link to comment https://forums.phpfreaks.com/topic/186072-help-with-decryption/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2009 Share Posted December 22, 2009 The data that will be encrypted with the given cipher and mode. If the size of the data is not n * blocksize, the data will be padded with '\0'. They are null characters \0. You can use the trim function to remove them. Quote Link to comment https://forums.phpfreaks.com/topic/186072-help-with-decryption/#findComment-982648 Share on other sites More sharing options...
tutorialstuff Posted December 22, 2009 Author Share Posted December 22, 2009 Thanks for the quote! I missed that. Quote Link to comment https://forums.phpfreaks.com/topic/186072-help-with-decryption/#findComment-982691 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.