@tv84,
>./ads_fwf_checksum.py SDS2000x_1.2.2.2R10.ADS
ED2FE8CD - 32 bit checksum
CD - 8 bit checksum
FBD42874 - 32 bit checksum
74 - 8 bit checksum
now the crc32 result looks ok.
I had used the crc32.py module from
https://github.com/StalkR/misc/blob/master/crypto/crc32.pyAfter replacement of "ord(c)" by "c" as the read function fetch
a byte stream, I was able to calc the crc32 sum of the .ads fwf.
Thanks
Markus
>cat ./ads_fwf_checksum.py
#! /usr/bin/python3
import sys, os, shutil
import functools
from crc32 import CRC32
input = sys.argv[1]
data = bytearray(open(input, 'rb').read())
# Or data can be declared directly
# data = bytes([0x02,0x00,0x00,0x04,0x00,0x00]);
csum = functools.reduce(lambda x,y: x+y, data, 0)
csum = ~csum + 1
csum = csum & 0xffffffff # the only difference is here
print (format(csum, 'X'),"- 32 bit checksum")
csum = csum & 0xff # the only difference is here
print (" ",format(csum, 'X'),"- 8 bit checksum")
csum2 = CRC32().calc(data)
print (format(csum2, 'X'),"- 32 bit checksum")
csum2 = csum2 & 0xff # the only difference is here
print (" ",format(csum2, 'X'),"- 8 bit checksum")