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; 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. 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. Link to comment https://forums.phpfreaks.com/topic/186072-help-with-decryption/#findComment-982691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.