Craig Hopson Posted July 11, 2012 Share Posted July 11, 2012 hi i have this function to encrypt data in cookies is this the correct way? <?phpdefine('SALT', 'hyDap4XQ6TDu');function encrypt($text){ return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));}function decrypt($text){ return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));}?> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 11, 2012 Share Posted July 11, 2012 There's not one correct way to encrypt. If that works for you, then use it. Link to comment Share on other sites More sharing options...
Craig Hopson Posted July 11, 2012 Author Share Posted July 11, 2012 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now