Simmo Posted December 17, 2006 Share Posted December 17, 2006 HiI plan to use this function to encrypt and decrypt:function encryptData($data, $p) { $iIV = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256,MCRYPT_MODE_ECB), MCRYPT_RAND); $sEncrypted = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, $p, $data, MCRYPT_MODE_ECB, $iIV); return(base64_encode($sEncrypted));}function decryptData($data, $p) { $data = base64_decode($data); $iIV = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $sDecrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $p, $data, MCRYPT_MODE_ECB, $iIV); return(trim($sDecrypted));}I read somewhere that using the base64_encode is easily decrypted. I have not used this sort of code before but from what I see it is encrypted first with mcrypt and then the base64 is added for good measure.If I am right then it is encrypted really well and is just what I am after, so if someone can put me straight I would be greatful.Thanks Quote Link to comment 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.