Welcome Guest, Not a member yet? Register   Sign In
URI-Safe Encrypt Library Extension
#6

[eluser]fserrano[/eluser]
It might be better to encode and decode to base64 before replacing the characters. I was having some issues with this library until I combined it with TheFuzzyOne's similar code in the helper found here: http://ellislab.com/forums/viewthread/107741/

Here's what I'm using:
Code:
<?php
class MY_Encrypt extends CI_Encrypt
{
    
    function encode($str="")
    {
        return strtr(
                base64_encode($str),
                array(
                    '+' => '.',
                    '=' => '-',
                    '/' => '~'
                )
            );
    }
    function decode($str="")
    {
        return base64_decode(strtr(
                $str,
                array(
                    '.' => '+',
                    '-' => '=',
                    '~' => '/'
                )
            ));
    }
}
?>

Let me know what you think.


Messages In This Thread
URI-Safe Encrypt Library Extension - by El Forum - 03-22-2009, 05:56 PM
URI-Safe Encrypt Library Extension - by El Forum - 03-23-2009, 04:32 AM
URI-Safe Encrypt Library Extension - by El Forum - 03-23-2009, 05:19 AM
URI-Safe Encrypt Library Extension - by El Forum - 08-19-2009, 09:12 PM
URI-Safe Encrypt Library Extension - by El Forum - 04-13-2010, 11:51 AM
URI-Safe Encrypt Library Extension - by El Forum - 04-15-2010, 06:34 PM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 08:32 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 09:10 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 09:12 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 09:55 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 10:28 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 10:40 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 11:06 AM
URI-Safe Encrypt Library Extension - by El Forum - 05-13-2010, 11:41 AM
URI-Safe Encrypt Library Extension - by El Forum - 07-09-2010, 02:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB