rxbanditboy1112 Posted September 20, 2007 Share Posted September 20, 2007 I am wondering if anyone has experienced an error encrypting and decrypting in and out of mysql. Sometimes when I decrypt then send an email to with the decrypted string it will still be encrypted. The strange thing is, this is unconsistant. Usually it will be fine, but other times it will keep something encrypted. All the values I am entering are numeric. I am however not currently checking for that. Any help or ideas would be greatly appreciated. I am using MCRYPT functions with trim.... Quote Link to comment https://forums.phpfreaks.com/topic/69996-unpredictable-encrypt-and-decrypt/ Share on other sites More sharing options...
rxbanditboy1112 Posted September 20, 2007 Author Share Posted September 20, 2007 here is how im encrypting and decrypting, there is alot more going on, but i guess i want to check that this is correct.... the first line is sent into mysql.... mcrypt_encrypt(MCRYPT_3DES, $key, addslashes($_POST['variable]), MCRYPT_MODE_ECB, $iv) $decrypt_val= mcrypt_decrypt(MCRYPT_3DES, $key, stripslashes($members_row[variable]), MCRYPT_MODE_ECB, $iv); $x =trim($decrypt_val); Quote Link to comment https://forums.phpfreaks.com/topic/69996-unpredictable-encrypt-and-decrypt/#findComment-351551 Share on other sites More sharing options...
trq Posted September 20, 2007 Share Posted September 20, 2007 I would remove the calls to addslashes / stripslashes for starters. You don't need to addslashes to the data until it is ready to insert into the database. Stripslashes isn't really needed at all. Quote Link to comment https://forums.phpfreaks.com/topic/69996-unpredictable-encrypt-and-decrypt/#findComment-351557 Share on other sites More sharing options...
rxbanditboy1112 Posted September 21, 2007 Author Share Posted September 21, 2007 cool thanks for the advice. Quote Link to comment https://forums.phpfreaks.com/topic/69996-unpredictable-encrypt-and-decrypt/#findComment-352561 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.