GD77 Posted April 18, 2013 Share Posted April 18, 2013 Hello:I m facing an issue with codeigniter encode encrypt decode, different results for the same string each time... thought the I m still on same server and same key been using for couple of days... Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/ Share on other sites More sharing options...
Christian F. Posted April 18, 2013 Share Posted April 18, 2013 We'll need a "bit" more information than that, as you should be aware of by know... Post the code you're using, give us some examples of the strings you're using, and the different results you get. Most likely there's either some whitespace messing you up, or some differences in the (pre-)encryption process. Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425553 Share on other sites More sharing options...
GD77 Posted April 18, 2013 Author Share Posted April 18, 2013 nothing special simple encrypt decrypt: $txt="hello"; $r1=$this->encrypt->encode($txt); $r2=$this->encrypt->decode($r1); Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425556 Share on other sites More sharing options...
trq Posted April 18, 2013 Share Posted April 18, 2013 And the results are? Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425568 Share on other sites More sharing options...
GD77 Posted April 18, 2013 Author Share Posted April 18, 2013 ok I v e noticed the issue occurs when i m encrypting an email address...I ve dropped the CI built in and tried similar approach with the following: function encryptz($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)))); }//END Fn encryptz function decryptz($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))); }//END Fn decryptz The data I m decrypting are returned through a url so using: $this->input->get('var'); works except if var was returning an encrypted e-mail address... Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425573 Share on other sites More sharing options...
trq Posted April 18, 2013 Share Posted April 18, 2013 Cool. That still doesn't help us at all. Are we done here? Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425585 Share on other sites More sharing options...
GD77 Posted April 18, 2013 Author Share Posted April 18, 2013 (edited) -.- still issue with codeigniter built n encrypt when you encrypt an email address it does not decrypt... Edited April 18, 2013 by GD77 Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425586 Share on other sites More sharing options...
GD77 Posted April 18, 2013 Author Share Posted April 18, 2013 so sorry forgot about urlencode :/ *smashing my head into the wall* Quote Link to comment https://forums.phpfreaks.com/topic/277099-codeigniter-encode-encrypt-decode-mismatch/#findComment-1425592 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.