C # Description program described by MD5 algorithm

Source: Internet
Author: User
Tags hash integer md5

MD5 Algorithm Description

When I'm writing a MD5 algorithm, I find that there are some inaccuracies in the language descriptions in both English and Chinese, and some details are not clear or obscure. Finally have to come up with C language source program to debug, which is very unfavorable to understand the algorithm. So I summed up some of the points I felt.

1. Origin

The full name of MD5 is message-digest algorithm 5 (Information-Digest algorithm, which was computer L. Ronald from MIT Laboratory for Rive and RSA Data Security Inc. in the early 90. St developed, through MD2, MD3 and MD4 development. Http://www.ietf.org/rfc/rfc1321.txt, is a most authoritative document,

Submitted to Ieft by Ronald L. Rivest in August 1992.

2. Use

The role of MD5 is to generate an information digest (message-digest) for a piece of information (message) that is unique to that information and can be digitally signed. Used to verify the validity of the file (whether there are any missing or corrupted data), encrypt the user's password, and compute the hash value in the hash function.

3. Features

Enter a byte string of any length, generating a 128-bit integer. Because of some irreversible features of the algorithm, it has good security in the application of encryption. Also, the use of the MD5 algorithm does not require any copyright fees to be paid.

4. Notes

Uniqueness and irreversibility are not absolute, theoretically it is a many-to-many relationship, but the probability of two different information producing the same abstract is very small. Irreversible refers to the need for the input from the output of the computation and calculation time is too large, the use of a poor dictionary search method requires too much storage space.

5. Algorithm description

The algorithm input is a byte string, each byte is 8 bit. The execution of the algorithm is divided into the following steps:

The first step is to fill the position:

The MD5 algorithm first complements the input data so that the length of the data (in bytes) for 64 is 56. That is, the data is extended to len=k*64+56 bytes, and K is an integer.

Complement method: Fill a 1, then fill 0 to meet the above requirements. Equivalent to a 0x80 byte, and a complement of 0 bytes. The total number of bytes added in this step is 0~63.

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.