Here are some simple xor encoding functions that I wrote. This will keep
the average joe from peaking at your data.

function decode($data){
        $data = base64_decode($data);
        /* XOR data */
        for($i = 0; $i < strlen($data); $i++){
                $data[$i] = ~ $data[$i];
        }
        return $data;
}

function encode($data){
        /* XOR data */
        for($i = 0; $i < strlen($data); $i++){
                $data[$i] = ~ $data[$i];
        }
        $data = base64_encode($data);
        return $data;
}

-----Original Message-----
From: Joel Ricker [mailto:[EMAIL PROTECTED]] 
Sent: Friday, October 05, 2001 7:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] crypt and decrypt a string


Does anybody have an easy way to crypt and decrypt a string?  I see the
Mcrypt Encryption module but thats a little more gung-ho than I'm
looking for.  I'm not trying to encrypt sensitive data rather I'm more
trying obfuscate it a variable for a hidden tag.

Thought I remember seeing something using XOR?  Any ideas?

Thanks
Joel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to