MD4 hash

 

About MD4 hash

MD4 is not a decryption algorithm; it is a cryptographic hash function. Hash functions like MD4 are designed to take input data and produce a fixed-size hash value, typically represented as a string of characters. This hash value is unique to the input data, meaning that even a small change in the input data should result in a significantly different hash value.

Here's a step-by-step description of how the MD4 hash function works:

  1. Padding: The input message is padded to a length that is congruent to 448 modulo 512. Padding is done by appending a single '1' bit followed by '0' bits until the message length satisfies the padding requirement. Additionally, the length of the original message is encoded as a 64-bit integer and appended to the padded message.
  2. Initialization: MD4 uses four 32-bit words, denoted as A, B, C, and D, to store intermediate hash values. These are initialized to specific constant values defined by the MD4 specification.
  3. Processing: The padded message is processed in 512-bit blocks. Each block is divided into 16 32-bit words, denoted as M[0], M[1], ..., M[15]. For each block:
    • A temporary set of variables, denoted as AA, BB, CC, and DD, is initialized with the values of A, B, C, and D, respectively.
    • Four rounds of operations are performed. Each round consists of 16 steps, and each step applies a non-linear function F, which operates on three 32-bit words, and a left rotation operation.
    • The result of each round is added to the corresponding intermediate hash value (A, B, C, or D) modulo 2^32.
  4. Finalization: After processing all blocks, the final hash value is obtained by concatenating the four 32-bit intermediate hash values, usually in the order: A, B, C, D. This produces a 128-bit hash value.
  5. Output: The resulting 128-bit hash value is the MD4 hash of the input message.

It's important to note that MD4 is vulnerable to collision attacks and should not be used for cryptographic purposes. More secure hash functions like SHA-256 or SHA-3 are recommended for cryptographic applications.