# Simple Hash Functions

Simple Hash Functions is the important topic of the Subject Information and Network Security.

Two simple, insecure hash functions are shown here.

Moreover, All hash functions operate using the following general principles.

- The input (message, file, etc.) is viewed as a sequence of
-bit blocks.*n* - The input is processed one block at a time in an iterative fashion to produce an -bit hash function
**.**

### First Function: Simple Hash Functions

One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of every block.

This can express as

𝑖 = 𝑏𝑖1⨁𝑏𝑖2 ⊕ … ⊕ 𝑏𝑖𝑚

Where

𝐶

_{𝑖 }= 𝑖th bit of the hash code, 1 ≤ 𝑖 ≤ n𝑚 = number of n − bit blocks in the input

𝑏

_{𝑖𝑗 }= 𝑖th bit in jth block⊕= XOR operation

- This operation produces a simple parity for each bit position and known as a longitudinal redundancy check.
- It is reasonably effective for random data as a data integrity check.
- Moreover, Each n-bit hash value is equally likely.
- Thus, the probability that a data error will result in an unchanged hash value is 2
^{-n}.

### Second Function: Simple Hash Functions

A simple way to improve matters is to perform a one-bit circular shift, or rotation, on the hash value after each block processed.

The procedure can summarize as follows.

- Initially set the n-bit hash value to zero.
- Process each successive n-bit block of data as follows:
- Rotate the current hash value to the left by one bit.
- XOR the block into the hash value.

- This has the effect of “randomizing” the input more completely and overcoming any regularities that appear in the input.
- Moreover, Although the second procedure provides a good measure of data integrity, it is virtually useless for data security.
- Moreover, When an encrypted hash code used with a plaintext message, it an easy matter to produce a new message that yields that hash code.

Simply prepare the desired alternate message and then append an n-bit block that forces the new message plus block to yield the desired hash code.

**Related Terms**

Information and Network Security, Chosen ciphertext attacks, Advanced Encryption Standard (AES), Security RSA

## Leave a Reply