Jump to content

Archived

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

GD77

codeigniter encode encrypt decode mismatch

Recommended Posts

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

 

 

Share this post


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.

Share this post


Link to post
Share on other sites

nothing special simple encrypt decrypt:

 

$txt="hello";

$r1=$this->encrypt->encode($txt);

$r2=$this->encrypt->decode($r1);

Share this post


Link to post
Share on other sites

And the results are?

Share this post


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:

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

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

 

Share this post


Link to post
Share on other sites

Cool. That still doesn't help us at all. Are we done here?

Share this post


Link to post
Share on other sites

-.- still issue with codeigniter built n encrypt when you encrypt an email address it does not decrypt...

Share this post


Link to post
Share on other sites

so sorry forgot about urlencode :/ :( *smashing my head into the wall*

Share this post


Link to post
Share on other sites

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