Introduction to MD5 and simple use

Source: Internet
Author: User

Introduction to MD5 and simple use

Principles:
 
MD5 is the Message-Digest Algorithm 5 (Information-Digest Algorithm version 5th), used to ensure the complete consistency of information transmission. It is one of the widely used Hash Algorithms in computers (also known as digest algorithms and hash algorithms). mainstream programming languages have been implemented by MD5. Computation the data into another fixed length value (in hexadecimal format: 32 bits) is the basic principle of the hash algorithm. The predecessor of MD5 is MD2, MD3, and MD4.

The function of MD5 is to compress large-capacity information into a confidential format before signing a private key using digital signature software (that is, to convert a byte string of any length into a certain length of sixteen number string ). In addition to MD5, sha-1, RIPEMD, and Haval are well-known.

A brief description of the MD5 algorithm can be: MD5 processes input information in 512-bit groups, and each group is divided into 16 32-seat groups, after a series of processing, the algorithm output consists of four 32-bit groups. After these four 32-bit groups are cascade, a 128-bit hash value is generated.

Algorithm:

Introduction
 
# Touch test1.txt test2.txt // --> Create an empty file for testing
# Ls-lart
Total 8
Drwxr-xr-x 5 root 4096 Aug 5 ..
-Rw-r -- 1 root 0 Aug 5 14:48 test2.txt
-Rw-r -- 1 root 0 Aug 5 14:48 test1.txt
Drwxr-xr-x 2 root 4096 Aug 5.
# Md5sum test *. txt> test. md5 // --> place the md5 file generated by the file series to test. md5.
# Cat test. md5
D41d8cd98f00b204e9800998ecf8427e test1.txt
D41d8cd98f00b204e9800998ecf8427e test2.txt
 

# Echo 'hello'> test1.txt // --> modify an object
# Md5sum-c test. md5 // --> use the md5sum command to add the-c parameter verification
Test1.txt: FAILED
Test2.txt: OK
Md5sum: WARNING: 1 of 2 computed checksums did NOT match

NOTE:

  • Although the sha1sum algorithm and principle are different from those of md5sum, the command usage is almost the same. Man sha1sum; man md5sum
  • According to its principle, the probability of the generated verification code is very small.

Java implements MD5 encryption and decryption

MD5 encryption used in Java Projects

Verify file integrity with MD5sum in Linux

Use the MD5 computing function of OpenSSL

Calculate the MD5 value of a file in Linux

This article permanently updates the link address:

 

 

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.