Search Tutorials
The encryption algo I chose was the simple XOR encryption. It's not strong, but then again, if you wanna code a better version then feel free. strText resembles the text you would like to keep intact Essentially, what happens, is the ASCII is XORed against the password, until all the text is broken into a numeric encrypted array and then posted to whichever site.
strText = "This is the holder text";
strPW = "password";
encText = "";
pwLength = strPW.length;
//XOR crypt the strText with the strPW
//and insert everything into a comma delimitated array of numbers
for (x=0; x<strText.length; x++) {
i = (i%pwLength)+1;
encText += (Number(strText.charCodeAt(x) ^ strPW.charCodeAt(i-1)));
encText += ",";
}
//delete the password from being posted in plaintext
strPW = "";
strText = "";
//post the data
getURL("http://yoursitehere.com/test.php", "_self", "POST");
On the other side, the PHP code catches and decrypts the post
<?php
$strPW = "password";
$pwLength = strlen($strPW);
$strText = "";
$i = 0;
$crypt = split(",", $encText);
// decrypt the the array, with size -1 to compensate for extra comma
for ($x = 0; $x < count($crypt) - 1; $x++) {
$i = ($i % $pwLength) + 1;
$hold = chr($crypt[$x] ^ ord($strPW[$i-1]));
$strText .= $hold;
}
echo "
now you can use a function like is_numeric to make sure the integrity of your encrypted data has been kept. Or you could you an MD5 system. Hope this helps with your score posts!
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|