1

I use the following two commands to get the checksum of text file, but it gives me two different checksums, why?

md5sum log
sha1sum log
0

1 Answer 1

7

md5sum and sha1sum implement two different hashing algorithms, MD5 and SHA-1 respectively, so the outputs will be different.

Note that, md5sum generates 128 bit hash whereas sha1sum generates 160 bit hash.

As a side note, both of them are considered cryptographically insecure now. Consider using SHA-2 family of hashes e.g. sha512sum for any implementation that requires much robustness. Although just for checking the integrity of file(s), they can be considered usable.

Also check man md5sum, and man sha1sum.

Video explaining checksums.

8
  • Yes, I check the manual page of both the commands. Author of both commands is same, so what is a difference between these two algorithm? Oct 16, 2016 at 8:12
  • @SagarParkale Here: crypto.stackexchange.com/q/18612
    – heemayl
    Oct 16, 2016 at 8:27
  • So which one should I use md5 or sha1 Oct 16, 2016 at 9:01
  • @SagarParkale For simple file integrity checking, any one of them would do.
    – heemayl
    Oct 16, 2016 at 9:02
  • in above link, says that md5 is broken, what does it means? Oct 16, 2016 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .