It is often useful to obtain a hash (MD5, SHA1, etc.) of an S-record file to see if two S-record files are the same. However, this doesn't account for the possibility that two S-record files specify identical memory contents but are specified differently (different record lengths, different order, variations in line breaks, etc.).
I was thinking about defining a variant of MD5 and SHA1 that takes this into account and will always return the same hash for an S-record file that defines the same memory locations with the same values.
I can think of a number of ways to define this. For example:
a)Read the S-record file.
b)Create a set of records, one for each memory location that is defined.
c)Sort these by memory address.
d)Create a string by concatenating these, i.e. "0000:A9/0001:B6/0002:3A/8000:23".
e)Use the hash of this string.
Are there any other ideas? Any better or more thoughtful way to do it?
Thanks, Dave.