You're right and I made some tests: base64 encoding and decoding are the same in LiveCode and PHP.
An example of the problem I encounter:
Code: Select all
on mouseUp
put "testing encryption" into theString
put "banana" into theKey
put myCrypt(theKey,theString) into cryptedString
put cryptedString // returns: "U2FsdGVkX1+iykvqj69YVLreBFyoS99plklLbDC2EiSbxZpJ6fZ/2wVYjof/0VNC"
end mouseUp
function myCrypt theKey,theString
encrypt base64Encode(theString) using "blowfish" with password theKey -- default 128 bits
return base64Encode(it)
end myCrypt
For testing purpose, I copy "
U2FsdGVkX1+iykvqj69YVLreBFyoS99plklLbDC2EiSbxZpJ6fZ/2wVYjof/0VNC" (without quotes, of course), and paste it into the following PHP script, to be sure that XML text file part has nothing to do with my problem:
Code: Select all
$theKey = "banana";
$theString = "U2FsdGVkX1+iykvqj69YVLreBFyoS99plklLbDC2EiSbxZpJ6fZ/2wVYjof/0VNC";
echo myDeCrypt($theKey,$theString); // returns: "�}*�� �b "
function myDeCrypt($theKey,$theString) {
$it = base64_decode($theString,false);
$it = mcrypt_decrypt(MCRYPT_BLOWFISH,$theKey,$it,MCRYPT_MODE_ECB,'0');
return base64_decode($it,false);
}
I perform a double base64 encoding in order to prevent some "strange" characters thta could cause XML strange behaviour. I tested the scripts with only one base64 encoding but th problem is the same.
I'm using LiveCode Community Edition 7.0.0