Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Md5 detailed explanation

Shulou Source: shulou.com Published: 2022-06-01 03:39:05 10月06日 Update

First of all, the data is interpreted as a binary number in memory, and then the whole binary number is modeled as 512. After taking the module, the binary number (0 to 512) is filled with a binary value of 1, and then binary 0 is filled until it is 448bit, that is, even if the module is exactly 448bit, the binary value of 512bit is still filled. The value reaches 448bit again, and then the data length value before filling is expressed as a binary number of 64bit, which is added to the data that has been filled before, so that the number of bit bits is exactly an integer multiple of 512. how to fill the data length before filling is expressed as a binary number exceeding 64bit, then take a low 64bit to fill in the back, so that the whole data is an integer multiple of 512.

The data is an integer multiple of 512 and also an integer multiple of 16. The M array M [0 32bit 1. NMur1] represents the destination data, that is, the original data to be encrypted. Then, the initial data of the four MD5 is used to calculate the MD5 value, expressed as hexadecimal.

A:01 23 45 67

B:89 ab cd ef

C:fe dc ba 98

D:76 54 32 10

Then four auxiliary functions are used, and the data processed are 32bit binary numbers:

F (X ~ Y _ Z) = X ~ Y | (~ X) & Z

G (X ~ Z) = X ~ Z | Y (~ Z)

H (Xmeny Y Z.) = X ^ Y ^ Z

I (X ~ Z) = Y ^ (X | (~ Z))

A table T [1.64] with 64 elements is also used here. T [I] represents the I element in the table, each element is fixed, equivalent to the integer part of the number 4294967296 * abs (sin (I)) (where I is the arc value, all given).

/ / N represents the total number of blocks of 32bit

/ / the operation needs to be cycled 16 times.

Then the following operations are performed for each 512bit (that is, 16word) data (I represents 16 word):

The first 512bit to the last 512bit loop operation / / for (int iTuno switch I

Tags: Data operations binary integers arrays elements four wheels numbers one round loop original three rounds number position copy table length two rounds lieutenant general digit Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology macOS Docker Shulou Tech Info