I'd like to define a message digest of an S-record file to be something that is independent of the specific formatting of the file. For my purposes, two S-record files are identical if they specify precisely the same memory locations with the same contents.
For those not familiar with an S-record file:
The issue with S-record files is that it is possible to specify an identical memory load in more than one way. For example, just editing the S-record file and swapping two lines will result in a file that is logically identical. Or, one might have records of varying lengths but the end result of what they specify might be the same.
My idea is that I should:
a)Parse the S-record file to form a set of (address, data) 2-tuples, i.e. one 2-tuple for each specified byte.
b)Sort the 2-tuples by address.
c)Concatenate the 2-tuples in the sorted order and take the SHA1 or MD5 of that concatenation.
The SHA1 or MD5 should be the same for S-record files that specify the same memory load but are perhaps formatted differently.
Questions:
a)Is there any advantage or disadvantage to using the raw binary data in the
2-tuples?b)Anything I'm not thinking about?
Thanks, Dave.