md5 checksum how to
January 21st, 2007 mysurface Posted in Misc, md5sum | Hits: 96705 |
First of all, what is md5 ?
MD5 is an algorithm that is used to verify data integrity through the creation of a 128-bit message digest from data input (which may be a message of any length) that is claimed to be as unique to that specific data as a fingerprint is to the specific individual. MD5, which was developed by Professor Ronald L. Rivest of MIT, is intended for use with digital signature applications, which require that large files must be compressed by a secure method before being encrypted with a secret key, under a public key cryptosystem. MD5 is currently a standard, Internet Engineering Task Force (IETF) Request for Comments (RFC) 1321.
Okay this definition is extracted from http://searchsecurity.techtarget.com
Simple Usage, we use md5 to verify the correctness of something we have downloaded. You always provided with md5 fingerprint while downloading large file such as iso images for linux distro. It is just a line of 128 bit string.
Why I need to do the checking? Is it important?
To ensure the file you downloaded is not corrupted. Yes, it is important. If you try to burn the iso that is corrupted to CD, the CD may not work properly.
How to check?
Uses md5sum, the simple way is run the command line straight away. Let say you want to check the file ubuntu-6.10-desktop-i386.iso.
md5sum ubuntu-6.10-desktop-i386.iso
With this, it prints out the 128 bit fingerprint strings. Tally the string you obtained with the provided one. Provider do the same way to obtain this string and publish to the site.
Another way let say you have more files to verify, you can create a text file, such as md5sum.txt
283158c7da8c0ada74502794fa8745eb ubuntu-6.10-alternate-amd64.iso
549ef19097b10ac9237c08f6dc6084c6 ubuntu-6.10-alternate-i386.iso
5717dd795bfd74edc2e9e81d37394349 ubuntu-6.10-alternate-powerpc.iso
99c3a849f6e9a0d143f057433c7f4d84 ubuntu-6.10-desktop-amd64.iso
b950a4d7cf3151e5f213843e2ad77fe3 ubuntu-6.10-desktop-i386.iso
a3494ff33a3e5db83669df5268850a01 ubuntu-6.10-desktop-powerpc.iso
2f44a48a9f5b4f1dff36b63fc2115f40 ubuntu-6.10-server-amd64.iso
cd6c09ff8f9c72a19d0c3dced4b31b3a ubuntu-6.10-server-i386.iso
6f165f915c356264ecf56232c2abb7b5 ubuntu-6.10-server-powerpc.iso
4971edddbfc667e0effbc0f6b4f7e7e0 ubuntu-6.10-server-sparc.iso
First column is the md5 string and second column is the location of the file. To check all them from file, do this:
md5sum -c md5sum.txt
The output will be like this if success
...
ubuntu-6.10-desktop-amd64.iso: OK
ubuntu-6.10-desktop-i386.iso: OK
...
Live Chat!







July 3rd, 2007 at 10:35 pm
short and sweet, to the point with an explanation of what it is :)
August 15th, 2007 at 3:40 am
It’s very beautifully.
October 3rd, 2007 at 1:38 am
[...] To perform sha1 checksum, it works similar to md5sum, kinda refers back to the examples here. [...]
April 26th, 2008 at 11:52 pm
G8 help
Similarly to find out sha1 sum use
$sha1sum
October 14th, 2008 at 1:26 am
Thanks for the tutorial! I was wondering if it is possible to md5 a string in the shell. Md5sum only seems to work on files. I’m fairly new to Linux and want to compare the speed between hashing around 1,000,000 strings in Linux and Powershell. What I’m hoping to end up with something like:
while ($i < 1000000)
{
md5sum $i;
$i++;
}
Probably doing it all wrong, but hopefully you get the point :). Any help would be greatly appreciated.
December 4th, 2008 at 11:47 pm
Hi Jonathan,
You probably figured this out a long time ago but try this script.
#!/bin/bash
#
let count=0
while (( $count /dev/null
let count=”count + 1″
done
# end of script
Give the script a name like md5loop and get time info as
follows. Don’t forget to make the file executable.
[prompt]$ time -p ./md5loop
December 5th, 2008 at 12:03 am
In me previous post all characters between “less than” and “greater than” symbols were swallowed.
I have reposted the script but replaced the left arrow with LT and the right arrow with GT.
#!/bin/bash
#
let count=0
while (( $count LT 10 )); do
echo $count | md5sum GT /dev/null
let count=”count + 1″
done
January 21st, 2009 at 10:06 pm
Have you ever had md5sum inconsistencies? I was working on transferring a large tarballs (4-11GB) to a remote server and kept re-tarring, gzip, bzip2 only to find out that it was inconsistent.
[blabla@blabla backups]$ md5sum -c archive.tar.bz2.md5sum
archive.tar.bz2: FAILED
md5sum: WARNING: 1 of 1 computed checksum did NOT match
[blabla@blabla backups]$ cat archive.tar.bz2.md5sum
fcc6749c143480c897b55a8203e42ae6 archive.tar.bz2
[blabla@blabla backups]$ md5sum archive.tar.bz2
fcc6749c143480c897b55a8203e42ae6 archive.tar.bz2
[blabla@blabla backups]$ man md5sum
[blabla@blabla backups]$ md5sum -c archive.tar.bz2.md5sum
archive.tar.bz2: OK
The host/filename renamed by the way.
March 9th, 2009 at 10:51 pm
Excellent !!
March 24th, 2009 at 9:42 am
Hi - thanks for the examples.
I have two DVD’s, one of which I suspect of being corrupt. I can run md5sum with a text file as above:
md5sum -c md5sum.txt
Unfortunately the md5sum.txt file is 4134 lines long, and it is a little tricky to see if any of them do not have OK at the end.
Is there a way to get only the lines that have an error in the result?
I have just realized I have the iso I made the disk from, so can compare md5sum disk.iso with md5sum /dev/scd0, but maybe a useful trick for the future :-)
don
April 3rd, 2009 at 2:05 am
Hi Don, you could use this:
md5sum -c md5sum.txt | grep -v “: OK”
You’ll get a list with incorect files.
April 3rd, 2009 at 2:28 am
This is a very minor help. You don’t say where to get the MD5sum utility nor anything about which folder to be in to run the command line, etc. Very little help.
April 3rd, 2009 at 5:03 pm
I downloaded Cent-OS 5.3 and began installing. It was failing after a few mins. After messing up with it several times and wondering if there is any hardware fault, I remembered I can check md5sum of the ISO files I downloaded. Your post helped me to get it straight to the point and I discovered that two of the files have been corrupted during download. Thank you very much - you saved my day!
pato83’s comment is very useful when you have several files to check.
February 12th, 2010 at 5:43 pm
I’m using this online tool to hash a string, check this Online Md5 Converter
Pretty cool! :)
David