I don't see where you are resetting crc to zero before it is calculated, for each block.
C-string tutorial. C - Strings