Home > Common Problem > body text

what is md5

藏色散人
Release: 2019-06-03 10:08:12
Original
55932 people have browsed it

MD5 is a very common word in the software industry. Even if you have never used it and don’t know what it is, you must have heard of it.

what is md5

So what is MD5? Is it an encryption algorithm? No, md5 is an information digest algorithm, which can generate a special string from a string or a file according to certain rules (this special string is called a digest, I understand that it is processed by extracting some information fragments from the file), and the MD5 digest corresponding to a file is fixed. When the file content changes, its MD5 value will be different (although theoretically it may be the same, But the probability is extremely small), therefore, the MD5 value is often used in applications to verify whether a piece of data has been tampered with.

For example, the sender of the data generates an MD5 value from the original data, and then transmits the original data together with its MD5 value to the receiver. After receiving the received data, the original data is first generated using the MD5 algorithm. summary information, and then compare this summary information with the summary information sent by the sender. If they are consistent, it is considered that the original data has not been modified, otherwise the original data has been modified.

MD5 value has several characteristics:

1. It is a fixed-length piece of data, that is, a 128-bit binary segment composed of "0" and "1" data. No matter how long or short the original data is, its MD5 value is 128bit.

2. Usually (or industry regulations), this 128-bit data is divided into 32 groups according to 4 bits. Each group calculates its value in hexadecimal, and outputs each group in the form of characters. value. For example, the calculated value of a set of data in hexadecimal is 0-9, and the printed value is also 0-9. If the calculated value is a-f, if printed directly, it will be 10-15. String can be used in Java. format(" So what we usually call the MD5 value refers to this 32-bit string consisting of "0-9, a-f". If you see an MD5 that is not 32-bit, or if it contains characters other than "0~f", it must be a wrong MD5 value.

3. Determinism. The MD5 value of an original data is unique. It is impossible to calculate multiple different MD5 values ​​for the same original data.

4. Collision. The original data and its MD5 value are not in one-to-one correspondence. It is possible that the MD5 values ​​calculated by multiple original data are the same. This is a collision.

5. Irreversible. That is to say, if you are told an MD5 value, you cannot restore its original data through it. This is not because your technology is not good enough, but because of its algorithm. Because according to point 4, a given MD5 value may correspond to multiple original data, and theoretically it can correspond to an infinite number of original data, so it is impossible to determine which original data is generated.

The above is the detailed content of what is md5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
md5
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template