Current location - Quotes Website - Signature design - How many bits are output by MD5, SHA 1 and SHA256 respectively?
How many bits are output by MD5, SHA 1 and SHA256 respectively?
MD5 outputs 128 bits, SHA 1 output 160 bits, and SHA256 outputs 256 bits.

1, MD5 Message-Digest Algorithm (English: MD5 Message-Digest Algorithm), a widely used cryptographic hash function, can generate a hash value of 128 bits (16 bytes) to ensure the integrity and consistency of information transmission.

2.SHA 1 secure hash algorithm is mainly applicable to the digital signature algorithm defined in the digital signature standard. SHA 1 will generate a message digest of 160 bits for messages with a length of less than 2 64 bits.

3. The 3.sha256 hash value is used as a unique value representing a fixed size of a large amount of data. A small change in data will produce a large number of unpredictable hash value changes. The hash value of SHA256 algorithm is 256 bits.

Extended data:

MD5 application:

1, consistency verification

The typical application of MD5 is to generate a message digest for a message to prevent it from being tampered with. Specifically, the MD5 value of a file is like the "digital fingerprint" of the file. The MD5 value of each file is different. If someone makes any changes to the file, its MD5 value, that is, the corresponding "digital fingerprint", will change.

For example, the download server provides an MD5 value for the file in advance. After the user downloads the file, use my algorithm to recalculate the MD5 value of the downloaded file. By comparing whether these two values are the same, you can judge whether the downloaded file is wrong or whether the downloaded file has been tampered with.

2. Digital signature

The typical application of MD5 is to generate fingerprints for messages (byte strings) to prevent them from being tampered with.

Example: Write a paragraph in a file named readme.txt, generate an MD5 value for this readme.txt and record it, then you can spread this file to. If you modify anything in the file, you will find it when you recalculate the MD5 of the file (the two MD5 values are different).

If there is a third-party certification authority, MD5 can also prevent the "denial" of the document author, which is the so-called digital signature application.

3. Secure access authentication

MD5 is also widely used in login authentication of operating systems, such as Unix, login passwords of various BSD systems, digital signatures and many other aspects. For example, in a Unix system, the user's password is hashed with MD5 (or other similar algorithm) and stored in the file system.

When the user logs in, the system performs MD5 hash operation on the password entered by the user, and then compares it with the MD5 value stored in the file system to judge whether the entered password is correct.

Even if the source program and algorithm description are exposed, the value of MD5 cannot be converted back to the original string. Mathematically speaking, it is because there are infinitely many original strings, which is a bit like a mathematical function without inverse function.

Baidu Encyclopedia -MD5

Baidu encyclopedia -SHA 1

Baidu encyclopedia -sha256