+QFUPL: How is the checksum calculated?

Docs say that the response to AT+QFUPL is:
+QFUPL: <upload_size>,<checksum>

I’m uploading successfully, but can’t figure out how the module is calculating the checksum.
For example, if I upload my 1187 byte cert, the module reports:
+QFUPL: 1187,2d19
but I can’t figure out how it’s calculating 2d19.

I read this post:
https://forums.quectel.com/t/bg96-checksum-for-file-after-uploaded-c-code/5297
but neither algorithm produces the 2d19 checksum that’s reported with the +QFUPL:

Could you provide some insight? Maybe the crc-calc code snippet from the module itself?

Thanks,
-Dave

@dlchambers_aperia Did you ever figure this out?

@knodi Nope :frowning:
You’d think Quectel could just post the source to their function. CRC-calc is pretty simple…

Try this python code, provide the input file via stdin:

import sys

checksum = 0
buff = sys.stdin.buffer.read(2)
while len(buff) != 0:
    if len(buff) == 1:
        buff += b"\x00"
    checksum ^= int.from_bytes(buff)
    buff = sys.stdin.buffer.read(2)
print(hex(checksum))