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.

Link to comment
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:

$this->input->get('var');

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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