BITXOR in ColdFusion from PHP
Hello,
im trying to rewrite bitXOR code from PHP to Coldfusion:
token is byteArray
string is String
PHP:
for($i = 0;$i < $length; $i++){
$xor .= ($token[$i] ^ $string[$i]);
}
Here is what i have so far in CF:
<cfscript >
var theXOR="";
var i=1;
var token = CharsetEncode(token,"utf-8");
for (; i le length; i++ ) {
xor = xor & rJustify(formatbaseN(bitXor(asc(mid(token,i,1)),asc(mid(string,i,1))),"16"),2);
}
</cfscript>
The problem is that the CF result is not the same as PHP.
PHP code does what I need.
What I'm doing wrong?
Thanks for help.
