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
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
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.