Home > Back-end >  JAVA exclusive or decryption code, Delphi encryption code
JAVA exclusive or decryption code, Delphi encryption code

Time:10-01

The server in JAVA code, the client Delphi USES IdMappedPortTCP forwarding encryption
Known the server-side JAVA code:
 
Public byte [] dec () {
Int xorByte=88;
Int hiByte=this. _in. Read ();//high packet length was obtained from the packet in bytes
Int loByte=this. _in. Read ();//low packet length was obtained from the packet in bytes
HiByte ^=xorByte;//use different or decrypt
LoByte ^=xorByte;//use different or decrypt
Final int dataLength=((loByte & lt; <8) + hiByte) - 2;//get the real length
Final byte data []=new byte [dataLength];

Int readSize=0;
for (int i=0; (I!=1) & amp; & (readSize & lt; DataLength); ReadSize +=I) {//get the rest of the packet
I=this. _in. Read (data, readSize dataLength - readSize);
}
for(int i=0; I & lt; DataLength; I++) {
Data [I]=(byte) (data [I] ^ _client. _xorByte);
}

Return the data.
}

This code is very simple, it is to decrypt the sealing synthetic vision or 88,
Now the client sends is proclaimed in the packet, I need to use Delphi IdMappedPortTCP OnExecute event in the clear packet encryption, and then sent to the server, the request using xor encryption expert with Delphi code,

CodePudding user response:

Data into a byte array, and then use xor xor encryption, I can't study your Java code, you change yourself

CodePudding user response:

But after I use the xor encryption, server decrypted data is wrong?

CodePudding user response:

The decryption key is byte (88), the decryption is byte (88),
Carefully checked your algorithm, only the packet length of key is byte (88), the other key data is _client _xorByte?
  • Related