Discovered the problem when using my app on my phone…
I found that on the computer I can have values in my WorkArray that are greater than 127 and on the Android phone I cannot. In this code I run through my WorkArray and XOR each element with a Key to encrypt the file.
for(var x=4;x<WorkArray.length;x++){
WorkArray[x]=WorkArray[x] ^ Key;
Key=WorkArray[x];
if(WorkArray[x]<0){
TempValue=WorkArray[x];
WorkArray[x]=(TempValue & 0x7F)+128;
}
}
After XOR with Key the result was always a negative value so I added the if statement to convert the value to positive, which becomes always greater than 127.
Elements [0] thru [2] are always set to 0
Element [3] always show the data length
Element [4] and on has encrypted values and the differences are shown below.
This shows the WorkArray element values ran on my phone.
This shows the WorkArray element values ran on my PC.
I am trying to find a way to keep the whole 8 bit value to work in my phone. In my Java version (trying to convert to use here) I cast each element with (Byte) and the Array is in the proper format to send. Is there anything like that available in JS? This is the only place I’ve used JS so I’m not familiar with it.
Jerry