Hi,
I have problems in converting following C routine to a
Java routine:
I have following code in Java
CODE]
private static int r = 55665 ;
private static final int c1 = 52845 ;
private static final int c2 = 22719 ;
private static byte decrypt(byte cipher) {
byte plain;
if (cipher < 0)
plain = (byte)(cipher ^ (r>>>8));
else
plain = (byte)(cipher ^ (r>>8));
r = (byte) ((cipher + r) * c1 + c2) % 65536;
return plain;
}[
[/CODE]
Appareantly this is not correct.
I especially have some difficulties in define an 'unsigned short int' in Java.
Can someone give me the correct Java code of this piece of C code ?
Thank very much,
Stefan