verifyChecksum method

void verifyChecksum()

Recomputes CRC-32C and throws when it does not match the stored value.

A no-op for documents without a checksum.

Implementation

void verifyChecksum() {
  final stored = checksum;
  if (stored == null) return;
  final actual = VxsCrc32c.compute(buffer, bodyStart, bodyEnd);
  if (actual != stored) {
    throw VxsFormatException(
      'checksum mismatch: stored 0x${stored.toRadixString(16)}, '
      'computed 0x${actual.toRadixString(16)}',
      offset: bodyEnd,
    );
  }
}