Here are some useful Internet resources when you have to deal with CRC calculation and checking. I found them handy and use occasionally. Some are online calculators, some gives also technical descriptions.
It is tested and working. It calculates CRC CCITT16 with starting value 0xFFFF. It might be not as fast as table based CRC calculations, but occupies less RAM and code space which sometimes is essential for embedded systems.