Interview question: Which encryption algorithm does MD5 belong to? Don't step on these pits

Some friends complained that when they went to the interview, they often heard the interviewer ask such questions as "symmetric encryption", "asymmetric encryption", and "MD5 encryption". So which encryption algorithm does MD5 belong to? When you encounter such a problem, you must be careful. This is a pit dug for you by the interviewer, so don't jump into the pit foolishly.

Attention! MD5 encryption is purely a mouthful, MD5 is a digest algorithm, not an encryption algorithm! Remember.

In order to allow everyone to clearly understand the definitions and scenarios of encryption algorithms and digest algorithms, let me show you a picture, is it clear at a glance?

The purpose of the encryption algorithm is to make it impossible for others to successfully view the encrypted data, and to decrypt the data to re-view the data when needed.

The MD5 algorithm is a hash algorithm, which is irreversible. In other words, the data obtained through the hash algorithm cannot be restored through any algorithm. Therefore, since the data cannot be restored, it cannot be called decryption; since it cannot be decrypted, the process of hashing cannot be called encryption.

digest algorithm

Digest algorithm, also known as hash algorithm, hash algorithm. Through a function, the content of any length is converted into a fixed-length data string.

The reason why the digest algorithm can point out whether the data has been tampered with is because the digest function is a one-way function, which is easy to calculate, but it is very difficult to deduce the data through the digest. Moreover, modifying a bit of the original data will resulting in a completely different calculated digest.

Can md5 be decrypted?

cannot. Since MD5 is not an encryption algorithm, there is no MD5 decryption. (The following tells you that it is actually possible for this special case)

At this time, some people will say, why are there many websites on the Internet that claim to be able to decrypt MD5? For example this: md5.cn

There is only one truth: because this website records some commonly used plaintext and its corresponding ciphertext, such as ordinary 123456, abc123, iloveyou, etc., which have been recorded long ago, so when we enter the ciphertext to be decrypted, we can Match the decryption result stored in the database.

Encryption Algorithm

Encryption: It uses a special algorithm to change the original information, so that even if an unauthorized user obtains the encrypted information, they still cannot understand the content of the information because they do not know the decryption method.

Decryption: The reverse process of encryption is decryption, which is the process of converting the encrypted information into its original information.

 

​Encryption algorithms are divided into symmetric encryption and asymmetric encryption. The encryption and decryption keys of the symmetric encryption algorithm are the same, and the keys of the asymmetric encryption and decryption are different.

Summarize

The purpose of the encryption algorithm is to: Prevent information from being peeped

The purpose of the digest algorithm is to: Prevent information from being tampered with

During the interview, be careful not to fall into the pit that the interviewer dug for you. MD5 is a digest algorithm, not an encryption algorithm, and MD5 is irreversible. Also, we can restore the ciphertext with a rainbow table, so it's not safe. To solve this problem, we need to generate a different password each time by adding salt, which solves this problem.

Guess you like

Origin blog.csdn.net/m0_69916115/article/details/127889721