private boolean validateChecksum(long offset, ByteBuff data, int hdrSize) {
      // If this is an older version of the block that does not have checksums, then return false
      // indicating that checksum verification did not succeed. Actually, this method should never
      // be called when the minorVersion is 0, thus this is a defensive check for a cannot-happen
      // case. Since this is a cannot-happen case, it is better to return false to indicate a
      // checksum validation failure.
      if (!fileContext.isUseHBaseChecksum()) {
        return false;
      }

      // If the checksumType of the read block header is incorrect, it indicates that the block is
      // corrupted and can be directly rolled back to HDFS checksum verification
      if (!checkCheckSumTypeOnHeaderBuf(data)) {
        HFile.LOG.warn(
          "HBase checksumType verification failed for file {} at offset {} filesize {}"
            + " checksumType {}. Retrying read with HDFS checksums turned on...",
          pathName, offset, fileSize, data.get(HFileBlock.Header.CHECKSUM_TYPE_INDEX));
        return false;
      }

      return ChecksumUtil.validateChecksum(data, pathName, offset, hdrSize);
    }
Generates the checksum for the header as well as the data and then validates it. If the block
doesn't uses checksum, returns false.
@return True if checksum matches, else false.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java