I am in the process of bringing an API up from 2.7 to 3.8. It is built to communicate with an agent over a TCP socket. I am having an issue with a checksum not being calculated right. I get a message back from my agent that the Checksum is bad.
I know it is not my agent because the CRC check on header only packets are being accepted and the commands are executed correctly on the agent side.
The line of code I am having an issue with is:
body += format(struct.pack("=L", binascii.crc32(format(body).encode()) & 0xFFFFFFFF))
Previously on 2.7 this line of code had no encoding/formatting.
Does anyone know what I am doing wrong?
I have a strong feeling it pertains to the encoding of 'body string'. After breaking the line of code down to its components I confirmed that the int output of binascii.crc32() is different between 3.8 and 2.7 and doing a bit of reading on the variety of byte/char types there are I have become quite lost.