LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   md5sum vs. cksum vs. sha1sum (https://www.linuxquestions.org/questions/linux-newbie-8/md5sum-vs-cksum-vs-sha1sum-742074/)

bichonfrise74 07-22-2009 05:42 PM

md5sum vs. cksum vs. sha1sum
 
Hi,

I've been using md5sum to verify the transfer of a file from one server to another. Basically, I take the md5sum on the source server and compare it against the destination server.

Recently, I saw there were other methods to do this 'verification' by using cksum and sha1sum.

Below are some benchmark timings that I've done on a 1.5 GB file:
md5sum - 8.4 sec.
cksum - 8.0 sec.
sha1sum - 14.7 sec.

Correct me if I'm wrong for the following assumptions:
1. All of the checksumming methods are CPU intensive. Would anyone know which is the most CPU intensive?
2. md5sum is the more preferred method (not sure why).

So, if I only want to do a quick checksum, then can I use cksum? Or is there a faster but less reliable method to do checksum?

Thanks in advance.

unSpawn 07-22-2009 07:48 PM

Quote:

Originally Posted by bichonfrise74 (Post 3617037)
md5sum is the more preferred method

...or could it be sha1sum just isn't widely accepted yet as a replacement?


Quote:

Originally Posted by bichonfrise74 (Post 3617037)
So, if I only want to do a quick checksum, then can I use cksum?

Between two servers you control? Sure, what you want.


Quote:

Originally Posted by bichonfrise74 (Post 3617037)
Or is there a faster but less reliable method to do checksum?

If hash comparison is done to confirm reliable transfer then why would you be looking for something less reliable?

onebuck 07-22-2009 07:49 PM

Hi,

The algorithm for 'md5sum' is theoretically the best suited for the security of exchanging files/images such as an 'ISO' or other large files. By the use of the 'md5sum' we can transfer large files without the worry of corruption. Meaning if we have the sum then we compare our received file with the original sum then there is no need to have the original image to compare too. We just use the original sum to compare with. This method does prevent someone from corrupting the original form since it would be impossible to create the same sum as the original.

As for comparison to other hash code methods. I leave that too you as a LQ or Google search then discern the information to close the thread. :)

lazlow 07-22-2009 08:27 PM

from: http://en.wikipedia.org/wiki/Sha1sum

Quote:

However, sha1sum is still usable for general-purpose file checksumming, and is widely considered more secure than MD5 or a CRC.
And from: http://en.wikipedia.org/wiki/Md5sum

Quote:

md5sum should not be used in situations where security is important


All times are GMT -5. The time now is 05:37 PM.