Can someone explain what is the difference between md5sum and cksum, when I compare 2 binary files.
One difference I know is cksum gives the number of "bytes" also along with the checksum value, which md5sum doesn't give.
But my question is to compare 2 binary files, I can chose to use any of these at my will, or they have any specific purposes as well, for specific situations.
Thanks in advance for your help
If all you want is to check if 2 specific files are different or not, use
cmp FILE1 FILE2. It will stop at the first difference encountered, so you don't lose time calculating checksums for the entire file.If you do need a full checksum :
cksumdoes a 32 bit ckecksum (CRC-32), whilemd5sumdoes a "more reliable" 128 bit checksum.cksumbeing simpler, it may be faster in some cases, but it may also not be the case becausemd5sumhas been highly optimized for speed.cksumis part of POSIX, and may be present on some systems wheremd5sumis not.Note that on Mac OS X,
md5sumis not installed by default, but there ismd5. The output ofmd5 -ris in the same format as md5sum.