exFAT Boot Checksum

This sector contains a repeating 32-bit checksum of the previous 11 sectors. The checksum calculation excludes VolumeFlags and PercentInUse fields in Boot Sector (bytes 106, 107, 112). The checksum is repeated until the end of the sector. The number of repetitions depends on the size of the sector.

UNIT32 BootChecksum(const unsigned char data[], int bytes)
{
UINT32 checksum = 0;
for (inti = 0; i < bytes; i++)
{
if (i == 106 || i == 107 || i == 112)
continue;
checksum = (checksum << 31) | (checksum >> 1) + data[i];
}
return checksum;
}