To start with, please assume that my algorithm for generating keys in both LSL and PHP is 100% secure. I'm using a number of tricks basically resulting in an encryption key that changes with each message. No security through obscurity here; just a key long enough that by the time a brute force attack cracks it it won't be of any use to the would-be hacker (it would in fact be a minimum of several months; my keys are useless after 10 minutes maximum).
Anyway, the issue I'm encountering now is not with the generation of the key, that works fine. The issue seems to be in decrypting the strings in PHP; namely that they sometimes don't decrypt the whole-way. That is, an arbitrary chunk of the string will be decrypted correctly, while everything after this point will be gibberish.
I've verified that the issue is on the PHP end as it decrypts fine in LSL, and it isn't the in-transit part as the PHP script is receiving the whole encrypted message, and using the correct key to decrypt it.
Here is the base64 xor function I am using to encrypt/decrypt messages on the PHP end:
CODE
function xorBase64($s1, $s2) {
$s1 = base64_decode($s1); $l1 = strlen($s1);
$s2 = base64_decode($s2);
if($l1 > strlen($s2))
$s2 = str_pad($s2, $l1, $s2, STR_PAD_RIGHT);
return base64_encode($s1 ^ $s2);
}Any help is much appreciated!
Also possibly of note; the message being encrypted is URL encoded (successfully, no truncation). I can't imagine the URL standard characters could really cause any issues, but I had trouble with @ symbols before.
Although it doesn't seem to be an particular symbol, as the script is currently sending identical messages (with different encryption keys), sometimes it will randomly succeed though the failure rate is currently very high.

