Calculate the CRC of the string '123456789'. using polynomial 0x11021
or 10001000000100001.
Initialise with 0xFFFF, append 0x0000, most significant bit first, don't
flip the CRC bits;
FF | 11111111 |
1 | 00110001 |
2 | 00110010 |
3 | 00110011 |
4 | 00110100 |
5 | 00110101 |
6 | 00110110 |
7 | 00110111 |
8 | 00111000 |
9 | 00111001 |
00 | 00000000 |
0xFFFF 1 2 3 4 5 6 7 8 9 0x0000 11111111111111110011000100110010001100110011010000110101001101100011011100111000001110010000000000000000 11111111111111110 ← 1st bit of '1' 10001000000100001 ----------------- XOR 01110111111011111 0xEFDF 11101111110111110 10001000000100001 ----------------- XOR 01100111110011111 0xCF9F 11001111100111111 10001000000100001 ----------------- XOR 01000111100011110 0x8F1E 10001111000111101 10001000000100001 ----------------- XOR 00000111000011100 0x0E1C 00001110000111000 00011100001110000 00111000011100000 01110000111000001 ← Last bit of '1' 11100001110000010 ← 1st bit of '2' 10001000000100001 ----------------- XOR 01101001110100011 0xD3A3 11010011101000110 10001000000100001 ----------------- XOR 01011011101100111 0xB767 10110111011001111 10001000000100001 ----------------- XOR 00111111011101110 0x7EEE 01111110111011101 11111101110111010 10001000000100001 ----------------- XOR 01110101110011011 0xEB9B 11101011100110110 10001000000100001 ----------------- XOR 01100011100010111 0xC717 11000111000101111 10001000000100001 ----------------- XOR 01001111000001110 0x9E0E 10011110000011100 ← Last bit of '2' 10001000000100001 ----------------- XOR 00010110000111101 0x2C3D 00101100001111010 ← 1st bit of '3' 01011000011110100 10110000111101001 10001000000100001 ----------------- XOR 00111000111001000 0x71C8 01110001110010001 11100011100100010 10001000000100001 ----------------- XOR 01101011100000011 0xD703 11010111000000110 10001000000100001 ----------------- XOR 01011111000100111 0xBE27 10111110001001111 10001000000100001 ----------------- XOR 00110110001101110 0x6C6E 01101100011011101 ← Last bit of '3' 11011000110111010 ← 1st bit of '4' 10001000000100001 ----------------- XOR 01010000110011011 0xA19B 10100001100110110 10001000000100001 ----------------- XOR 00101001100010111 0x5317 01010011000101111 10100110001011111 10001000000100001 ----------------- XOR 00101110001111110 0x5C7E 01011100011111100 10111000111111001 10001000000100001 ----------------- XOR 00110000111011000 0x61D8 01100001110110000 11000011101100000 ← Last bit of '4' 10001000000100001 ----------------- XOR 01001011101000001 0x9741 10010111010000010 ← 1st bit of '5' 10001000000100001 ----------------- XOR 00011111010100011 0x3EA3 00111110101000110 01111101010001101 11111010100011011 10001000000100001 ----------------- XOR 01110010100111010 0xE53A 11100101001110100 10001000000100001 ----------------- XOR 01101101001010101 0xDA55 11011010010101011 10001000000100001 ----------------- XOR 01010010010001010 0xA48A 10100100100010100 10001000000100001 ----------------- XOR 00101100100110101 0x5935 01011001001101011 ← Last bit of '5' 10110010011010110 ← 1st bit of '6' 10001000000100001 ----------------- XOR 00111010011110111 0x74F7 01110100111101110 11101001111011101 10001000000100001 ----------------- XOR 01100001111111100 0xC3FC 11000011111111001 10001000000100001 ----------------- XOR 01001011111011000 0x97D8 10010111110110000 10001000000100001 ----------------- XOR 00011111110010001 0x3F91 00111111100100011 01111111001000111 11111110010001110 ← Last bit of '6' 10001000000100001 ----------------- XOR 01110110010101111 0xECAF 11101100101011110 ← 1st bit of '7' 10001000000100001 ----------------- XOR 01100100101111111 0xC97F 11001001011111110 10001000000100001 ----------------- XOR 01000001011011111 0x82DF 10000010110111111 10001000000100001 ----------------- XOR 00001010110011110 0x159E 00010101100111101 00101011001111010 01010110011110101 10101100111101011 10001000000100001 ----------------- XOR 00100100111001010 0x49CA 01001001110010101 ← Last bit of '7' 10010011100101010 ← 1st bit of '8' 10001000000100001 ----------------- XOR 00011011100001011 0x370B 00110111000010110 01101110000101101 11011100001011011 10001000000100001 ----------------- XOR 01010100001111010 0xA87A 10101000011110101 10001000000100001 ----------------- XOR 00100000011010100 0x40D4 01000000110101000 10000001101010000 10001000000100001 ----------------- XOR 00001001101110001 0x1371 00010011011100010 ← Last bit of '8' 00100110111000100 ← 1st bit of '9' 01001101110001000 10011011100010001 10001000000100001 ----------------- XOR 00010011100110000 0x2730 00100111001100001 01001110011000011 10011100110000110 10001000000100001 ----------------- XOR 00010100110100111 0x29A7 00101001101001110 01010011010011101 ← Last bit of '9' 10100110100111010 ← 1st bit of 0x0000 10001000000100001 ----------------- XOR 00101110100011011 0x5D1B 01011101000110110 10111010001101100 10001000000100001 ----------------- XOR 00110010001001101 0x644D 01100100010011010 11001000100110100 10001000000100001 ----------------- XOR 01000000100010101 0x8115 10000001000101010 10001000000100001 ----------------- XOR 00001001000001011 0x120B 00010010000010110 00100100000101100 01001000001011000 10010000010110000 10001000000100001 ----------------- XOR 00011000010010001 0x3091 00110000100100010 01100001001000100 11000010010001000 10001000000100001 ----------------- XOR 01001010010101001 0x94A9 10010100101010010 10001000000100001 ----------------- XOR 00011100101110011 0x3973 00111001011100110 ← 15th bit of 0x0000 01110010111001100 0xE5CC ← Result 11111111111111110011000100110010001100110011010000110101001101100011011100111000001110010000000000000000 0xFFFF 1 2 3 4 5 6 7 8 9 0x0000 ↑ Stop
This clearly shows that the result is 0xE5CC, not 0x29B1.