The Linux shell command gets the MD5 value of the string/file

Source: Internet
Author: User



Gets the MD5 value of the string:



MD5 of the string "Hello":


$ Echo-n ' Hello ' |md5sum|cut-d '-f1





The resulting MD5 value:


5d41402abc4b2a76b9719d911017c592





Command explanation:


Md5sum: displays or checks the MD5 (128 bit) checksum. If there is no file option, or the file is "-", it is read from the standard input.
Echo - N: do not print line breaks.
Cut: cut is used to cut columns or fields from standard input or text files. Cut text to paste it into a text file.
-D specifies a different field separator from the space and tab keys. -F1 represents the first field. Refer here.





Gets the MD5 value of the file:


$ md5sum linuxmint-12-gnome-dvd-32bit.iso|cut-d "-f1


The resulting MD5 value:


Ee3d6e2ca498bc7685b7f17cdb5f2eea





Use MD5 to verify the ISO file:


$ md5sum Linuxmint-12-gnome-dvd-32bit.iso >linuxmint-12-gnome-dvd-32bit.md5





Note the contents of the LINUXMINT-12-GNOME-DVD-32BIT.MD5 are:


Ef3d6e2ca498bc7685b7f17cdb5f2eea Linuxmint-12-gnome-dvd-32bit.iso





Put Linuxmint-12-gnome-dvd-32bit and its verification files



LINUXMINT-12-GNOME-DVD-32BIT.MD5 put the following command in the same directory:


$ md5sum-c LINUXMINT-12-GNOME-DVD-32BIT.MD5





Output if the checksum is correct:


Linuxmint-12-gnome-dvd-32bit.iso: OK





If the checksum error is output:


Linuxmint-12-gnome-dvd-32bit.iso: failed
Md5sum: warning: 1 / 1 generated checksum mismatch
Command interpretation:
MD5 - C: read and check the check value of MD5 from the file 





Message Digest algorithm MD5 is a hash function widely used in the field of computer security to provide integrity protection for messages. The algorithm's file number is RFC 1321 (R.rivest,mit Laboratory for computer science and RSA Data Security Inc. April 1992)



Keywords:hash,sha,ronald L. RIVEST,MD5,IETF (Internet Engineering Task Force)






This article from "Nicol Lock Silk Sorrow" blog, please make sure to keep this source http://smoke520.blog.51cto.com/9256117/1917014



The Linux shell command gets the MD5 value of the string/file


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.