Calculate proper checksum