Jump to content

codeigniter encode encrypt decode mismatch


GD77

Recommended Posts

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.

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

 

Archived

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.