int actual_crc;
int out_len;
unsigned char key;
unsigned short hi_word, lo_word;
unsigned short packet_crc, sum_crc;
unsigned char* in;
int i;
char packet_data[ 1300 ];
int in_len = 100;
uint8_t in_stream[100] = { 202, 240, 218, 42, 202, 202, 194, 202, 202, 202, 203, 203, 202, 158, 130, 159, 141, 185, 184, 188, 156, 248, 234, 158, 139, 225, 137, 135, 202, 135, 171, 164, 162, 171, 190, 190, 171, 164, 202, 74, 163, 114, 207, 150, 203, 2, 59, 5, 202, 121, 242, 97, 151, 202, 202, 202, 202, 98, 62, 5, 202, 202, 59, 5, 202, 15, 242, 97, 151, 221, 213, 100, 151, 130, 62, 5, 202, 54, 53, 53, 53, 146, 62, 5, 202, 192, 215, 100, 151, 202, 202, 202, 202, 200, 202, 202, 202, 68, 182, 207 };
out_len = in_len - sizeof( unsigned short );
memcpy( &packet_crc, in_stream, sizeof( unsigned short ));
memcpy( packet_data, in_stream + sizeof( unsigned short ), out_len ); // skip CRC
key = (unsigned char) packet_crc; // use the lsB of the packet CRC to decrypt the packet
in = (unsigned char*) packet_data;
for( i = 0; i < out_len; i++ )
{
*in = (*in) ^ key;
in++;
//cout<<i;
//cout<<"::";
cout<<packet_data[i];
//cout<<"\n";
}
Type=method_call Endian=l Flags=0 Version=1 Cookie=1804 Timestamp="Thu 2024-02-22 10:33:53.447634 UTC"
С этой строкой ваше решение не работает.
Вывод