Home Common Problem md5 encryption algorithm

md5 encryption algorithm

Sep 02, 2019 am 09:18 AM
md5

What is the MD5 algorithm

MD5 Message-Digest Algorithm (English: MD5 Message-Digest Algorithm), a widely used cryptographic hash function that can produce a 128-bit The hash value (hash value) of 16 bytes is used to ensure that the information transmission is complete and consistent.

md5 encryption algorithm

MD5 function(Recommended learning: web front-end video tutorial)

Input information of any length, and after processing, the output is 128-bit information (digital fingerprint);

Different inputs result in different results (uniqueness);

MD5 does not belong to the encryption algorithm

People who think it does not belong to it are because they feel that they cannot get the original text from the ciphertext (hash value), that is, there is no decryption algorithm, so these people think that MD5 It can only belong to an algorithm and cannot be called an encryption algorithm;

Those who think it belongs are because they feel that they cannot see the original text after MD5 processing, that is, the original text has been encrypted, so they think MD5 is an encryption algorithm; I personally support it The former is just like thinking that the BASE64 algorithm can only be regarded as encoding.

Is the MD5 algorithm reversible?

The reason why MD5 is irreversible is that it is a hash function and uses a hash algorithm. During the calculation process, part of the original information is lost.

However, it is worth pointing out that in theory, one MD5 may indeed correspond to countless original texts, because there are a limited number of MD5s and there can be countless original texts. For example, the mainstream MD5 maps a "byte string" of any length into a 128-bit large integer.

That is, there are a total of 2^128 possibilities, which is about 3.4*10^38. This number is finite. , but there are countless possibilities for the original text that can be used to encrypt in the world.

But one thing to note is that although this is a theoretical finite versus infinite, the problem is this Infinity is not completely true in real life, because on the one hand, the length of the original text is often limited in reality (taking commonly used passwords as an example, most people are within 20 digits), on the other hand, we currently want to find that two pieces of original text correspond to the same It is very difficult to create an MD5 value (technically called hash collision). Therefore, in a sense, it is entirely possible to construct a one-to-one correspondence between the MD5 value and the original text within a certain range. Therefore, MD5 is currently the most effective The attack method is rainbow table. You can learn the details through Google.

MD5 is equivalent to lossy compression.

MD5 uses

1. Prevent tampering:

1) For example, when sending an electronic document, before sending, I first get the MD5 output result a. Then after the other party receives the electronic document, the other party also gets an MD5 Output result b. If a is the same as b, it means it has not been tampered with in the process.

2) For example, if I provide file downloads, in order to prevent criminals from adding Trojans to the installation program, I can publish the installation files on the website. The obtained MD5 output result.

3) SVN also uses MD5 when detecting whether the file has been modified after CheckOut.

2. To prevent direct viewing of plain text:

Many websites now store the MD5 value of the user's password when storing the user's password in the database. In this way, even if the criminals obtain the MD5 value of the user's password in the database, they will not be able to know the user's password. (For example, in a UNIX system, the user's password It is encrypted with MD5 (or other similar algorithms) and stored in the file system.

When the user logs in, the system calculates the password entered by the user into an MD5 value, and then saves it in the file system Compare the MD5 value in the system to determine whether the entered password is correct.

Through such steps, the system can determine the legitimacy of the user's login to the system without knowing the clear code of the user's password. This is not only It can prevent the user's password from being known by users with system administrator rights, and also increases the difficulty of password cracking to a certain extent.)

3. Prevent repudiation (digital signature):

This requires a third-party certification agency. For example, A writes a document, and the certification agency uses the MD5 algorithm to generate summary information for the file and keep a record.

If A later says that the document was not written by him, the authority The organization only needs to regenerate the summary information for the document, and then compare it with the summary information recorded in the record. If they are the same, it will be proved that it was written by A. This is called a "digital signature".

MD5 security

It is generally believed that MD5 is very safe, because the brute force cracking time is unacceptable to ordinary people. In fact, it is very unsafe if the user's password is MD5 processed and then stored in the database.

Because the user's password is relatively short, and many users' passwords use birthdays, mobile phone numbers, ID numbers, phone numbers, etc. Or use some commonly used auspicious numbers or an English word. If I MD5 the commonly used passwords first, store the data, and then match it with your MD5 result, then I may get the plaintext.

For example, there is an MD5 cracking website http://www.cmd5.com/default.aspx, so the password policy of most websites now is to force users to use a combination of numbers and uppercase letters to improve the security of user passwords. .

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

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use MD5 encryption in MySQL How to use MD5 encryption in MySQL May 28, 2023 pm 02:16 PM

What is MD5? MD5 Message-DigestAgorithm (English: MD5Message-DigestAgorithm), a widely used cryptographic hash function, can produce a 128-bit (16-byte) hash value (hash value) to ensure complete and consistent information transmission. MD5 was designed by American cryptographer Ronald Linn Rivest and made public in 1992 to replace the MD4 algorithm. The program of this algorithm is specified in the RFC1321 standard. After 1996, the algorithm was proven to have weaknesses and could be cracked. For data requiring high security, experts generally recommend using other algorithms.

PHP calculates MD5 hash of file PHP calculates MD5 hash of file Mar 21, 2024 pm 01:42 PM

This article will explain in detail about PHP calculating the MD5 hash of files. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP calculates the MD5 hash of a file MD5 (MessageDigest5) is a one-way encryption algorithm that converts messages of arbitrary length into a fixed-length 128-bit hash value. It is widely used to ensure file integrity, verify data authenticity and create digital signatures. Calculating the MD5 hash of a file in PHP PHP provides multiple methods to calculate the MD5 hash of a file: Use the md5_file() function. The md5_file() function directly calculates the MD5 hash value of the file and returns a 32-character

PHP calculates MD5 hash value of string PHP calculates MD5 hash value of string Mar 21, 2024 am 10:51 AM

This article will explain in detail how PHP calculates the MD5 hash value of a string. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. Calculating the MD5 hash value of a string in PHP Introduction MD5 (Message Digest 5) is a popular cryptographic hash function used to generate fixed-length hash values, often used to protect data integrity, verify file integrity and Create a digital signature. This article will guide PHP developers on how to use built-in functions to calculate the MD5 hash value of a string. md5() function PHP provides the md5() function to calculate the MD5 hash value of a string. This function receives a string parameter and returns a 32-character hexadecimal hash value.

What is the linux md5 tool What is the linux md5 tool Jun 29, 2023 am 10:51 AM

The linux md5 tool is a tool used to calculate and verify the MD5 hash value of a file. MD5 is a commonly used hash algorithm used to generate a unique, fixed-length hash value, usually 128 bits, in Use the md5sum command in the Linux terminal, and its syntax is "md5sum <file path>".

How to use Java to calculate the MD5 value of a modified file How to use Java to calculate the MD5 value of a modified file May 29, 2023 am 08:16 AM

What is MD5? MD5 (MessageDigestAlgorithm, message digest algorithm), a widely used cryptographic hash function, can produce a 128-bit (16-byte) hash value (hashvalue) to ensure complete and consistent information transmission. The number 5 after it is because it was invented to replace MD4. Simple understanding, its function is to give the file a unique identifier. If we modify the extension of a file, the file may not be opened, but for MD5, there is no change. So for a file, any renaming is useless for md5 verification. MD5 applications: Here are just a few of the more frequent applications I have seen.

How to achieve secure login with Java double MD5 encryption How to achieve secure login with Java double MD5 encryption May 17, 2023 pm 05:31 PM

1: The problem introduces the decryption operation of the password stored in the database: you can see that my password was successfully decrypted, which surprised me, because we all know that the MD5 algorithm is irreversible because it is a hash algorithm. The column function uses a hash algorithm, and part of the information in the original text is lost during the calculation process. So why can my password be decrypted on the website? After some searching, I found that the decryption principle of the online decryption tool is very simple. The principle is to collect simple passwords commonly used by users to form a password dictionary, and encrypt the passwords in the dictionary with MD5 and store them. In the so-called "decryption" "When the time comes, compare the ciphertext of the real user password encryption with the stored password. If the ciphertext exists in the dictionary,

How to implement md5 encryption using python How to implement md5 encryption using python May 13, 2023 pm 08:04 PM

Python implements MD5 encryption 1. Introduction MessageDigestAlgorithmMD5 (Chinese name is Message Digest Algorithm Fifth Edition) is a hash function widely used in the field of computer security to ensure complete and consistent information transmission. MD5 is a one-way encryption, which means it can only encrypt data but cannot decrypt it. It mainly solves the problem of data integrity. Digest algorithm is also called hash algorithm and hash algorithm. It converts data of any length into a fixed-length data string (usually represented by a hexadecimal string) through a function. MD5 is the most common digest algorithm. It is very fast. It can generate a string with a fixed length of 128 bits after executing md5 on a string, file, or compressed package.

How to solve the problem of merging java files and modifying md5 value How to solve the problem of merging java files and modifying md5 value May 10, 2023 pm 09:46 PM

Text file merging operation effect: Before operation: There are 9 files under this path. After running: A merge.txt file is generated. The file content display code part of this code has a very simple function. It is to merge text files one by one and write them into a total merge.txt folder. At that time, I learned to append content to the file. , so I wrote this demo. To put it simply, it is to get each file (text file, I filtered it.) to get an input stream, and then in a loop, write the information of one file into the merged file each time. When the loop ends, the file merge is completed. . packagecom.filemerge;importjava.io.BufferedRead