Jump to content

codeigniter encode encrypt decode mismatch


Recommended Posts


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...



Link to post
Share on other sites

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.

Link to post
Share on other sites

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:


works except if var was returning an encrypted e-mail address...


Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.