| 355 | SetXorKey(-1); |
| 356 | } |
| 357 | void AuthPacketCodec::XorCodeBuf(unsigned char *buffer,size_t length) |
| 358 | { |
| 359 | if(!xor_enc_key) |
| 360 | return; |
| 361 | const unsigned char *Key = (unsigned char *)&xor_enc_key; |
| 362 | *buffer ^= *Key; |
| 363 | for(size_t i=1; i<length; i++) |
| 364 | buffer[i] ^= buffer[i-1] ^ Key[i&7]; |
| 365 | xor_enc_key += length; |
| 366 | } |
| 367 | |
| 368 | void AuthPacketCodec::XorDecodeBuf(unsigned char *buffer,size_t length) |
| 369 | { |