PHP Classes

problem

Recommend this page to a friend!

      Secure hash based encryption  >  All threads  >  problem  >  (Un) Subscribe thread alerts  
Subject:problem
Summary:problem when '+' is in the encrypted URL
Messages:5
Author:Jeff Beethoven
Date:2007-01-02 21:57:28
Update:2007-06-22 01:18:31
 

  1. problem   Reply   Report abuse  
Picture of Jeff Beethoven Jeff Beethoven - 2007-01-02 21:57:28
I'm passing data from one php page to another using this encryption class. It works well except when the encypted text contains a '+'. Then is does not get decrypted to the correct value. For instance this works:

myurl.com?id=w8P/EuU5OpuwprkDW6tbyX ...

But this does not:

myurl.com?id=EloTXvg1+8e8VJSV/hUREC ...

Any ideas? Fixes?

Thanks.

Jeff

  2. Re: problem   Reply   Report abuse  
Picture of Jeff Beethoven Jeff Beethoven - 2007-01-02 22:08:42 - In reply to message 1 from Jeff Beethoven
I just needed to urlencode() the string. I'm fairly new to this...


  3. Re: problem   Reply   Report abuse  
Picture of Marc Wöhlken Marc Wöhlken - 2007-06-22 01:18:31 - In reply to message 2 from Jeff Beethoven
Urlencoding is indeed the right solution as unencoded strings may loose some information when transported via http get.

Regards
Marc

  4. Re: problem   Reply   Report abuse  
Picture of gexas keksas gexas keksas - 2015-01-26 22:24:30 - In reply to message 1 from Jeff Beethoven
Hi,

after:

function encrypt($string) {
$iv = $this->_generate_iv();

add:
$iv = strtr($iv, '+', 'h');

This replace "+" sign to "h" letter (You can use any letter/digit).

Hope this help's

Bye.

  5. Re: problem   Reply   Report abuse  
Picture of gexas keksas gexas keksas - 2015-01-26 22:30:03 - In reply to message 4 from gexas keksas
Sorry, earlier solution seems not working, posted it too early.
Hope so author of class can fix me in this..