added simple crc check

A crc check not sure if it works, it didn't in cygwin, code isn't very
portable.