one,
k data bits, set r check bits, then the check bits can represent 2^r states
2^r ≥ k + r + 1
2^r-1 ≥ k + r
Check code P is placed on the power of 2
Data D can be placed at will (generally from right to left, from low to high)
The value of the check code P is the XOR of the data D at the position H where the weight appears.
Finally got the Hamming code
2. Check
S1=P1 XOR D (D related to P1)
S2=P2 XOR D (D related to P2)
...
S1 is the low bit, the arranged number is converted to decimal , which is the position of the error data
If last converted decimal=0, there is no error.