Let's make a simple derivation to see how long parity bits are needed for information data with data bit m to meet the requirements of error correction.
The k-bit check code can have 2 k values. Obviously, one of the values indicates that the data is correct, and the remaining two values of k- 1 indicate that the data is incorrect. If it can satisfy: 2 k- 1 > M+k(m+k is the total length after encoding), in theory, k check codes can determine which bit (including information code and check code) has a problem.
So in theory, 32-bit data should be added with 6-bit check code.
Generally speaking, the parity code of Hamming Code will be inserted into the position of 1, 2, 4, 8 … data. According to the Hamming parity equation, the Hamming parity code can be obtained.