CRC check program

590 views Asked by At

I have a speech file on a alarm device i'd like to change/rerecord. the files are in VOX format ADPCM (NLEN1.bin) and i can play them in audacity. and re record them in cool edit. successfully created the same 512kb file size the problem is putting them back to the alarm device. i need to supply a bsc file with CRC values from the speech files. how do i get the CRC values for my new recorded speech files?

if i do a CRC check on the original files i cant get the values given in the bsc file. since i am reverse engineering, i assume i need CRC16

BSC file:

4278904898 NLEN1.bin

4280806306 NLEN2.bin

4280731940 NLEN3.bin

4291163785 NLEN4.bin

1

There are 1 answers

12
rickhg12hs On BEST ANSWER

With a bit of "observing" with IDA and Udis86 and also a bit of Python hacking, I was able to determine the checksum scheme used with the .bin and .bsc files.

Here's a little Python code (from within 'ipython') that shows how to generate the required checksum:

In [1]: f=open('NLEN2.bin','r')

In [2]: s=f.read()

In [3]: from arraymodule import *

In [4]: my_int8s=[b for b in array('b',s)]

In [5]: my_int8s[:10]
Out[5]: [2, -103, -110, 0, -128, -128, 0, 10, -125, 10]

In [6]: my_checksum=sum(my_int8s)%(2**32)

In [7]: my_checksum
Out[7]: 4280806306L

N.B.: The program appeared to sum exactly 524288 bytes in each .bin file.

N.B.: The Python above could be made faster/smaller if desired.

EDIT

Here's the "script" without the ipython line numbers, etc., and hopefully works on your Windows platform.

f=open('NLEN2.bin','rb')
s=f.read()
from array import *
my_int8s=[b for b in array('b',s)]
my_checksum=sum(my_int8s)%(2**32)
print("Checksum: %d\n" % my_checksum)