0

I have heard, but I now cannot find evidence that a checksum can vary from machine to machine where the file is the same. Is that true? We are considering relying on a checksum in our application that will be calculated on many different machines, will this be reliable?

CLJ
  • 1,907
  • 5
  • 22
  • 36
  • Well that's what checksums were designed for. If the algorithm is the same then the checksum should be the same from machine to machine; if it weren't, then what's the point? – Delan Azabani Apr 28 '11 at 16:16
  • You may want to use a cryptographic hash, like SHA1, instead. Checksums are fine, but not as reliable as a full-blown hash. – Marc B Apr 28 '11 at 16:18

2 Answers2

1

It depends on the algorithm. If you are using a multibyte (>8 bit) checksum that uses integer (two's complement) math, then you will get different results depending on the endianness of the machine.

This is why a lot of network checksum algorithms use one's complement math instead of two's complement.

If both machines are the same OS and archtecture, you should be OK (unless your algorithm does something really weird).

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
0

Yes, as long as you make sure you are using the same checksum algorithm, it will be fine.

Gustav Larsson
  • 8,199
  • 3
  • 31
  • 51