## Thursday, July 15, 2021

### Hash function based on cipher block chaining in cryptography

Hash Function based on cipher block chaining

Two major categories of hash functions are: dedicated hash functions and block cipher-based hash function. Figure : Cipher Block Chaining

Block cipher is a popular encryption-decryption primitives. To encrypt, the block cipher accepts a key K and a plain text block P as input and produces a cipher text block C = E(K, P), also written as C = EK(P).

By the definition of CBC: Cj = E(K, [Cj-1  Pj]) Figure : Hash Function based on CBC

The hash function takes an input message and partitions it into L fixed-sized blocks of b bits each. If necessary, the final block is padded to bits. The final block also includes the value of the total length of the input to the hash function. The inclusion of the length makes the job of the opponent more difficult. Either the opponent must find two messages of equal length that hash to the same value or two messages of differing lengths that, together with their length values, hash to the same value. The hash algorithm involves repeated use of a compression function, f, that takes two inputs (an n-bit input from the previous step, called the chaining variable, and a b-bit block) and produces an n-bit output. At the start of hashing, the chaining variable has an initial value that is specified as part of the algorithm. The final value of the chaining variable is the hash value. Often, hence the term compression.

The hash function can be summarized as