I’m moving a java android app to windows metro, this app has a heavy use of blobs and decoding (the blobs are coded to take less space on the DB
After copying the entire decoding code, the result is slightly different.
There are some parts where the asks if the byte value is lower than 0, as I understand, bytes on c# are alaways unsigned so i don’t understand why the result is not the same as the android app.
Here is a snippet.
for (int i = 0; i < length; i++) {
s[six] = (byte) (blob[i] ^ pronpassword[ix]); //pronpass is a string password
if (s[six] == 0) {
s[six + 1] = (byte)'-';
s[six] ^= 128;
s[six] = (byte) PRON_MAP[(byte) s[six]];
six++;
} else {
s[six] = (byte) PRON_MAP[(byte) s[six]];
}
six++;
ix++;
if (ix == plen)
ix = 0;
}
Thanks!
In Java,
byteis signed. There is actually no such thing as an unsigned byte in Java. It’s equivalent to C#’ssbyte, so that’s the type you should port it to.