Modularize the CRC calculation