个人工具

“UbuntuHelp:HowToMD5SUM”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第3行: 第3行:
 
The program '''''md5sum''''' is designed to verify data integrity using the MD5 (Message-Digest algorithm 5) 128-bit cryptographic hash. MD5 hashes used properly can confirm both file integrity and authenticity.
 
The program '''''md5sum''''' is designed to verify data integrity using the MD5 (Message-Digest algorithm 5) 128-bit cryptographic hash. MD5 hashes used properly can confirm both file integrity and authenticity.
 
In terms of integrity, an MD5 hash comparison detects changes in files that would cause errors. The possibility of changes (errors) is proportional to the size of the file; the possibility of errors increase as the file becomes larger. It is a very good idea to run an MD5 hash comparison check when you have a file like an operating system install CD that has to be 100% correct.
 
In terms of integrity, an MD5 hash comparison detects changes in files that would cause errors. The possibility of changes (errors) is proportional to the size of the file; the possibility of errors increase as the file becomes larger. It is a very good idea to run an MD5 hash comparison check when you have a file like an operating system install CD that has to be 100% correct.
In terms of security, cryptographic hashes such as MD5 allow for authentication of data obtained from insecure mirrors. The MD5 hash must come from a secure source (an HTTPS page) of an organization you trust. While security flaws in the MD5 algorithm have been uncovered, MD5 hashes are generally sufficient for casual use. Please refer to the secure [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page for the official list of Ubuntu MD5 hashes. FTP mirrors also host copies of MD5 hashes.
+
In terms of security, cryptographic hashes such as MD5 allow for authentication of data obtained from insecure mirrors. The MD5 hash must be signed or come from a secure source (an HTTPS page) of an organization you trust.  
 +
See the MD5SUMS file for the release you're using under http://releases.ubuntu.com (and optionally the [[GnuPrivacyGuardHowto|PGP]] signatures in the MD5SUMS.gpg file), or refer to the secure [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page for the official list of Ubuntu MD5 hashes.
 +
While security flaws in the MD5 algorithm have been uncovered, MD5 hashes are still useful when you trust the organization that produces them.  Moving to more secure hashes like SHA-256 and Whirlpool is under discussion.
 
== md5sum  ==
 
== md5sum  ==
The official '''md5sum page''' for Ubuntu, Kubuntu, Edubuntu and Xbuntu is [[UbuntuHelp:UbuntuHashes|UbuntuHashes]].  
+
The official '''md5sum page''' for Ubuntu, Kubuntu, Edubuntu and Xubuntu is [[UbuntuHelp:UbuntuHashes|UbuntuHashes]].  
[[Anchor(linux)]]
+
<<Anchor(linux)>>
 
== MD5SUM on Linux ==
 
== MD5SUM on Linux ==
 
Most Linux distributions come with the <code><nowiki>md5sum</nowiki></code> utility so installation is usually unnecessary. We are going to use the Ubuntu 6.10 Desktop install CD for the following example:
 
Most Linux distributions come with the <code><nowiki>md5sum</nowiki></code> utility so installation is usually unnecessary. We are going to use the Ubuntu 6.10 Desktop install CD for the following example:
第14行: 第16行:
 
Then run the following command from within the download directory.
 
Then run the following command from within the download directory.
 
<pre><nowiki>
 
<pre><nowiki>
md5sum ubuntu-6.10-desktop-i386.iso</nowiki></pre>
+
md5sum ubuntu-8.04-desktop-i386.iso</nowiki></pre>
 
The md5sum should print out a single line after calculating the hash:
 
The md5sum should print out a single line after calculating the hash:
 
<pre><nowiki>
 
<pre><nowiki>
b950a4d7cf3151e5f213843e2ad77fe3 ubuntu-6.10-desktop-i386.iso</nowiki></pre>
+
8895167a794c5d8dedcc312fc62f1f1f ubuntu-8.04-desktop-i386.iso</nowiki></pre>
 
Compare the hash (the alphanumeric string on left) that your machine calculated with the corresponding hash on the [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page. When both hashes match exactly then the downloaded file is almost certainly intact. If the hashes do not match, then there was a problem with either the download or a problem with the server. You should download the file again from either the same mirror, or from a different mirror if you suspect a server error. If you continuously receive an erroneous file from a server, please be kind and notify the webmaster of that mirror so they can investigate the issue.
 
Compare the hash (the alphanumeric string on left) that your machine calculated with the corresponding hash on the [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page. When both hashes match exactly then the downloaded file is almost certainly intact. If the hashes do not match, then there was a problem with either the download or a problem with the server. You should download the file again from either the same mirror, or from a different mirror if you suspect a server error. If you continuously receive an erroneous file from a server, please be kind and notify the webmaster of that mirror so they can investigate the issue.
If you have the correct md5sum in a file in the same directory as the iso, you can then check the md5sum semi-automatically with md5sum. You will typically find the md5sum file on the download page where you obtained your iso. Ubuntu distributes the md5sums in a file "MD5SUMS" on this file is on the download page.
+
If you have the correct md5sum in a file in the same directory as the iso, you can then check the md5sum semi-automatically with md5sum. You will typically find the md5sum file on the download page where you obtained your iso. Ubuntu distributes the md5sums in a file "MD5SUMS" on this file is on the download page.  
 
<pre><nowiki>
 
<pre><nowiki>
 
md5sum -c MD5SUMS
 
md5sum -c MD5SUMS
 
</nowiki></pre>
 
</nowiki></pre>
 
== MD5SUM on Mac OS X ==
 
== MD5SUM on Mac OS X ==
Follow the instructions for [[linux MD5SUM on Linux]], except use the command "md5" instead of "md5sum".
+
Follow the instructions for [[[linux|MD5SUM on Linux]]], except use the command "md5" instead of "md5sum".
 +
You can also find the MD5 hash using OS X's built in Disk Utility program. You can find it in the Utilities folder in Applications, or by choosing "Utilities" from the Finder's "Go" menu. Open Disk Utility and wait for it to gather information about your disks. Go to the directory where you downloaded the Ubuntu disk image, and drag it to Disk Utility's dock icon. For this example we'll be checking the Ubuntu 6.10 Desktop install CD. The disk image should show up on the left-hand side of Disk Utility, underneath your physical drives. Go to the "Images" menu and select Checksum > MD5. Be sure to choose "MD5" and NOT "MD5 image checksum", as they are not the same and will give you different results. Disk Utility will return, in this case, <code><nowiki>"Checksum of "ubuntu-6.10-desktop-i386.iso" completed. MD5 $b950a4d7cf3151e5f213843e2ad77fe3"</nowiki></code> Compare the MD5 Disk Utility gives you with the corresponding hash on the [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page. When both hashes match exactly then the downloaded file is almost certainly intact.
 +
If the hashes do not match, then there was a problem with either the download or a problem with the server. You should download the file again from either the same mirror, or from a different mirror if you suspect a server error. If you continuously receive an erroneous file from a server, please be kind and notify the webmaster of that mirror so they can investigate the issue.
 
== digest(1) on Solaris ==
 
== digest(1) on Solaris ==
 
Use the Solaris digest(1) command, specifying the md5 algorithm with the -a flag. For instance:
 
Use the Solaris digest(1) command, specifying the md5 algorithm with the -a flag. For instance:
第31行: 第35行:
 
4971edddbfc667e0effbc0f6b4f7e7e0</nowiki></pre>
 
4971edddbfc667e0effbc0f6b4f7e7e0</nowiki></pre>
 
== MD5SUM on Windows ==
 
== MD5SUM on Windows ==
Windows does not come with '''''md5sum'''''. You must download one from another location, preferably one that you trust. There are command line utilities (<code><nowiki>md5sum.exe</nowiki></code>) that work similarly to the Unix utility; one public domain version with source is available from [http://www.fourmilab.ch/md5/ Fourmilab], but the version available from [http://cygwin.com/ Cygwin] is probably easier to install and update, and Cygwin is also recommended and trusted as the source for many more Unixy utilities. Once installed, Cygwin's '''''md5sum''''' behaves exactly as described in '''''MD5SUM on Linux''''' above.
+
Windows does not come with '''''md5sum'''''. You must download one from another location, preferably one that you trust. There are command line utilities (<code><nowiki>md5sum.exe</nowiki></code>) that work similarly to the Unix utility; one public domain version with source is available from [[http://www.fourmilab.ch/md5/|Fourmilab]], but the version available from [[http://cygwin.com/|Cygwin]] is probably easier to install and update, and Cygwin is also recommended and trusted as the source for many more Unixy utilities. Once installed, Cygwin's '''''md5sum''''' behaves exactly as described in '''''MD5SUM on Linux''''' above.
 
There are also graphical tools such as the one used in the walk-through provided below.
 
There are also graphical tools such as the one used in the walk-through provided below.
<ol><li>Download and install [http://www.nullriver.com/index/products/winmd5sum winMD5Sum], a free and open source hash verification program.
+
<ol><li>Download and install [[http://www.nullriver.com/index/products/winmd5sum|winMD5Sum]], a free and open source hash verification program.
 
</li><li>Right-click the ISO file.
 
</li><li>Right-click the ISO file.
 
</li><li>Click Send To, then `winMD5Sum`.
 
</li><li>Click Send To, then `winMD5Sum`.
第40行: 第44行:
 
</li><li>Click "Compare"</li></ol>
 
</li><li>Click "Compare"</li></ol>
  
https://help.ubuntu.com/community/HowToMD5SUM?action=AttachFile&do=get&target=winMD5Sum.png
+
{{https://help.ubuntu.com/community/HowToMD5SUM?action=AttachFile&do=get&target=winMD5Sum.png%7D%7D
 
<ol><li>A message box will say "MD5 Check Sums are the same" if the hashes are equal.</li></ol>
 
<ol><li>A message box will say "MD5 Check Sums are the same" if the hashes are equal.</li></ol>
  
 +
A much more convenient hash program for windows is [[http://beeblebrox.org/hashtab/|HashTab]].
 +
It is a simple 1 click-installer and adds a new tab to the file properties dialog box as a shell extension. It is freeware and has no license agreement besides agreeing that it is the coolest thing ever.
 +
someone should probably add [[http://beeblebrox.org/hashtab/hashtab.jpg]] to this page. thx.
 
== MD5SUM on CD ==
 
== MD5SUM on CD ==
To see if your Ubuntu CD was corrupted when burned to the disk, see the [[UbuntuHelp:CDIntegrityCheck|CDIntegrityCheck]] page, or follow the instructions below.
+
To see if your Ubuntu CD was corrupted when burned to the disk, see the [[CDIntegrityCheck]] page, or follow the instructions below.
 
First mount the CD, if not already mounted:
 
First mount the CD, if not already mounted:
 
<pre><nowiki>
 
<pre><nowiki>
第54行: 第61行:
 
Be patient, it takes some time. If the command outputs any errors, you'll know that either the burn was bad or the .iso is corrupt. Please note that this method does not verify authenticity unless the hash of the iso file is compared to the hash at the secure [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page.
 
Be patient, it takes some time. If the command outputs any errors, you'll know that either the burn was bad or the .iso is corrupt. Please note that this method does not verify authenticity unless the hash of the iso file is compared to the hash at the secure [[UbuntuHelp:UbuntuHashes|UbuntuHashes]] page.
 
Finally, you can unmount the CD after leaving the folder:
 
Finally, you can unmount the CD after leaving the folder:
<pre><nowiki>cd /
+
<pre><nowiki>
 +
cd /
 
sudo umount /dev/hda</nowiki></pre>
 
sudo umount /dev/hda</nowiki></pre>
 
== External Links ==
 
== External Links ==
* [http://en.wikipedia.org/wiki/Cryptographic_hash_function Wikipedia's Cryptographic Hash Entry]
+
* [[http://en.wikipedia.org/wiki/Cryptographic_hash_function|Wikipedia's Cryptographic Hash Entry]]
----
+
[[UbuntuHelp:VerifyIsoHowto|VerifyIsoHowto]]
Outstanding Issues
+
* Something with respect to the MD5SUMS.gpg file should be added or linked to herein.
+
 
----
 
----
 
[[category:CategoryDocumentation]]
 
[[category:CategoryDocumentation]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 05:56的版本

The program md5sum is designed to verify data integrity using the MD5 (Message-Digest algorithm 5) 128-bit cryptographic hash. MD5 hashes used properly can confirm both file integrity and authenticity. In terms of integrity, an MD5 hash comparison detects changes in files that would cause errors. The possibility of changes (errors) is proportional to the size of the file; the possibility of errors increase as the file becomes larger. It is a very good idea to run an MD5 hash comparison check when you have a file like an operating system install CD that has to be 100% correct. In terms of security, cryptographic hashes such as MD5 allow for authentication of data obtained from insecure mirrors. The MD5 hash must be signed or come from a secure source (an HTTPS page) of an organization you trust. See the MD5SUMS file for the release you're using under http://releases.ubuntu.com (and optionally the PGP signatures in the MD5SUMS.gpg file), or refer to the secure UbuntuHashes page for the official list of Ubuntu MD5 hashes. While security flaws in the MD5 algorithm have been uncovered, MD5 hashes are still useful when you trust the organization that produces them. Moving to more secure hashes like SHA-256 and Whirlpool is under discussion.

md5sum

The official md5sum page for Ubuntu, Kubuntu, Edubuntu and Xubuntu is UbuntuHashes. <<Anchor(linux)>>

MD5SUM on Linux

Most Linux distributions come with the md5sum utility so installation is usually unnecessary. We are going to use the Ubuntu 6.10 Desktop install CD for the following example: First go to the correct directory to check a downloaded iso file:

cd download_directory

Then run the following command from within the download directory.

md5sum ubuntu-8.04-desktop-i386.iso

The md5sum should print out a single line after calculating the hash:

8895167a794c5d8dedcc312fc62f1f1f ubuntu-8.04-desktop-i386.iso

Compare the hash (the alphanumeric string on left) that your machine calculated with the corresponding hash on the UbuntuHashes page. When both hashes match exactly then the downloaded file is almost certainly intact. If the hashes do not match, then there was a problem with either the download or a problem with the server. You should download the file again from either the same mirror, or from a different mirror if you suspect a server error. If you continuously receive an erroneous file from a server, please be kind and notify the webmaster of that mirror so they can investigate the issue. If you have the correct md5sum in a file in the same directory as the iso, you can then check the md5sum semi-automatically with md5sum. You will typically find the md5sum file on the download page where you obtained your iso. Ubuntu distributes the md5sums in a file "MD5SUMS" on this file is on the download page.

md5sum -c MD5SUMS

MD5SUM on Mac OS X

Follow the instructions for [[[linux|MD5SUM on Linux]]], except use the command "md5" instead of "md5sum". You can also find the MD5 hash using OS X's built in Disk Utility program. You can find it in the Utilities folder in Applications, or by choosing "Utilities" from the Finder's "Go" menu. Open Disk Utility and wait for it to gather information about your disks. Go to the directory where you downloaded the Ubuntu disk image, and drag it to Disk Utility's dock icon. For this example we'll be checking the Ubuntu 6.10 Desktop install CD. The disk image should show up on the left-hand side of Disk Utility, underneath your physical drives. Go to the "Images" menu and select Checksum > MD5. Be sure to choose "MD5" and NOT "MD5 image checksum", as they are not the same and will give you different results. Disk Utility will return, in this case, "Checksum of "ubuntu-6.10-desktop-i386.iso" completed. MD5 $b950a4d7cf3151e5f213843e2ad77fe3" Compare the MD5 Disk Utility gives you with the corresponding hash on the UbuntuHashes page. When both hashes match exactly then the downloaded file is almost certainly intact. If the hashes do not match, then there was a problem with either the download or a problem with the server. You should download the file again from either the same mirror, or from a different mirror if you suspect a server error. If you continuously receive an erroneous file from a server, please be kind and notify the webmaster of that mirror so they can investigate the issue.

digest(1) on Solaris

Use the Solaris digest(1) command, specifying the md5 algorithm with the -a flag. For instance:

$ digest -a md5 ubuntu-6.10-server-sparc.iso
4971edddbfc667e0effbc0f6b4f7e7e0

MD5SUM on Windows

Windows does not come with md5sum. You must download one from another location, preferably one that you trust. There are command line utilities (md5sum.exe) that work similarly to the Unix utility; one public domain version with source is available from [[1]], but the version available from [[2]] is probably easier to install and update, and Cygwin is also recommended and trusted as the source for many more Unixy utilities. Once installed, Cygwin's md5sum behaves exactly as described in MD5SUM on Linux above. There are also graphical tools such as the one used in the walk-through provided below.

  1. Download and install [[3]], a free and open source hash verification program.
  2. Right-click the ISO file.
  3. Click Send To, then `winMD5Sum`.
  4. Wait for `winMD5Sum` to load and finish the checksum (this may take a significant amount of time depending on your computer's performance).
  5. Copy the corresponding hash from UbuntuHashes into the bottom text box.
  6. Click "Compare"

{{https://help.ubuntu.com/community/HowToMD5SUM?action=AttachFile&do=get&target=winMD5Sum.png%7D%7D

  1. A message box will say "MD5 Check Sums are the same" if the hashes are equal.

A much more convenient hash program for windows is [[4]]. It is a simple 1 click-installer and adds a new tab to the file properties dialog box as a shell extension. It is freeware and has no license agreement besides agreeing that it is the coolest thing ever. someone should probably add [[5]] to this page. thx.

MD5SUM on CD

To see if your Ubuntu CD was corrupted when burned to the disk, see the CDIntegrityCheck page, or follow the instructions below. First mount the CD, if not already mounted:

sudo mount /dev/hda /cdrom

Then use the supplied md5sum file on the CD:

cd /cdrom
md5sum -c md5sum.txt | grep -v 'OK$'

Be patient, it takes some time. If the command outputs any errors, you'll know that either the burn was bad or the .iso is corrupt. Please note that this method does not verify authenticity unless the hash of the iso file is compared to the hash at the secure UbuntuHashes page. Finally, you can unmount the CD after leaving the folder:

cd /
sudo umount /dev/hda

External Links

VerifyIsoHowto