/    /  CDCS – Hamming Distance

Hamming Distance

 

Hamming Distance is the benchmark to compare two binary data strings. It is the number of bit positions that the two bits are different to each other.

 

It is represented by the letter ‘d’. It comes to use during error detection and correction. 

 

Calculation

The XOR operation (a⊕ b) is performed between the strings and the total number of 1s in the resultant string are counted to calculate the Hamming Distance.

 

Example

Assume two strings ‘1101 1001’ and ‘1001 1101’.

11011001 ⊕ 10011101 = 01000100. 

Since, this contains two 1s, the Hamming distance:

d(11011001, 10011101) = 2.

 

Minimum Hamming Distance

When a set contains equal strings, the smallest Hamming Distance between all of the pairs of strings in the set is called the minimum Hamming Distance.