Verify the checksum in the header for this HDU.
422941
def verify_checksum(self):
        
        res = self._FITS.verify_checksum(self._ext+1)
        if res['dataok'] != 1:
            raise ValueError("data checksum failed")
        if res['hduok'] != 1:
            raise ValueError("hdu checksum failed")
371251
def checksum(entropy)
      b = Bitcoin.sha256([entropy].pack('B*')).unpack('B*').first
      b.slice(0, (entropy.length/32))
    end
408843
def _parse_and_check_header(self, data):
        """"""
        (start, self.pins, self.vid, self.pid, crc) = struct.unpack('<BIBBB',
                                                                    data)
        test_crc = crc32(data[:-1]) & 0x0ff
        if start == 0xEB and crc == test_crc:
            return True
        return False
808508
def check_checksum_mismatch(self):
        '''  '''
        if self.pefile_handle.OPTIONAL_HEADER:
            if self.pefile_handle.OPTIONAL_HEADER.CheckSum != self.pefile_handle.generate_checksum():
                return {'description': 'Reported Checksum does not match actual checksum', 
                        'severity': 2, 'category': 'MALFORMED'}
        return None
225528
function validateChecksum(requester, params) {
        params = params || {
            filePath: installerPath,
            expectedChecksum: _updateParams.checksum
        };

        var hash = crypto.createHash('sha256'),
            currentRequester = requester || "";

        if (fs.existsSync(params.filePath)) {
            var stream = fs.createReadStream(params.filePath);

            stream.on('data', function (data) {
                hash.update(data);
            });

            stream.on('end', function () {
                var calculatedChecksum = hash.digest('hex'),
                    isValidChecksum = (params.expectedChecksum === calculatedChecksum),
                    status;

                if (isValidChecksum) {
                    if (process.platform === "darwin") {
                        status = {
                            valid: true,
                            installerPath: installerPath,
                            logFilePath: logFilePath,
                            installStatusFilePath: installStatusFilePath
                        };
                    } else if (process.platform === "win32") {
                        status = {
                            valid: true,
                            installerPath: quoteAndConvert(installerPath, true),
                            logFilePath: quoteAndConvert(logFilePath, true),
                            installStatusFilePath: installStatusFilePath
                        };
                    }
                } else {
                    status = {
                        valid: false,
                        err: nodeErrorMessages.CHECKSUM_DID_NOT_MATCH
                    };
                }
                postMessageToBrackets(MessageIds.NOTIFY_VALIDATION_STATUS, currentRequester, status);
            });
        } else {
            var status = {
                valid: false,
                err: nodeErrorMessages.INSTALLER_NOT_FOUND
            };
            postMessageToBrackets(MessageIds.NOTIFY_VALIDATION_STATUS, currentRequester, status);
        }
    }
42341
def bech32_create_checksum(hrp, data):
    """"""
    values = bech32_hrp_expand(hrp) + data
    polymod = bech32_polymod(values + [0, 0, 0, 0, 0, 0]) ^ 1
    return [(polymod >> 5 * (5 - i)) & 31 for i in range(6)]
352568
protected function verifyChecksum(string $checksum, string $filePath) : bool
    {
        // Skip if checksum is empty.
        if (empty($checksum)) {
            return true;
        }

        return $checksum === $this->getServerChecksum($filePath);
    }
192600
def verify(path):
        """"""
        valid = False
        try:
            h5 = h5py.File(path, mode="r")
            qpi0 = h5["qpi_0"]
        except (OSError, KeyError):
            pass
        else:
            if ("qpimage version" in qpi0.attrs and
                "phase" in qpi0 and
                "amplitude" in qpi0 and
                "bg_data" in qpi0["phase"] and
                    "bg_data" in qpi0["amplitude"]):
                valid = True
        return valid
1000392
protected function calculateChecksum() {
        $this->checksumValue = 0;
        $c = strlen($this->text);
        for ($i = 0; $i < $c; $i++) {
            $this->checksumValue += $this->findIndex($this->text[$i]);
        }

        $this->checksumValue = $this->checksumValue % 43;
    }
897037
def _add_to_checksum(self, checksum, value):
        """"""
        checksum = self._byte_rot_left(checksum, 1)
        checksum = checksum + value
        if (checksum > 255):
            checksum = checksum - 255
        self._debug(PROP_LOGLEVEL_TRACE, "C: " + str(checksum) + " V: " + str(value))
        return checksum
205317
def Verify(self):
        
        if not self.Hash.ToBytes() == GetGenesis().Hash.ToBytes():
            return False

        bc = GetBlockchain()

        if not bc.ContainsBlock(self.Index):
            return False

        if self.Index > 0:
            prev_header = GetBlockchain().GetHeader(self.PrevHash.ToBytes())

            if prev_header is None:
                return False

            if prev_header.Index + 1 != self.Index:
                return False

            if prev_header.Timestamp >= self.Timestamp:
                return False

        # this should be done to actually verify the block
        if not Helper.VerifyScripts(self):
            return False

        return True
280094
def _checksum(self, packet):
        ''''''
        xorsum = 0
        for s in packet:
            xorsum ^= ord(s)
        return xorsum
862769
def file_checksum(filepath):
    
    checksum = hashlib.md5()
    with open(filepath, 'rb') as f:
        for fragment in iter(lambda: f.read(65536), ''):
            checksum.update(fragment)
    return checksum.hexdigest()
510486
public void registerNewChecksums(File featureDir, String fileName, String checksum) {
        ChecksumData checksums = checksumsMap.get(featureDir);
        if (checksums == null) {
            checksums = new ChecksumData();
            checksumsMap.put(featureDir, checksums);
        }
        checksums.registerNewChecksums(fileName, checksum);
    }
823490
def _validate_checksum(self, buffer):
        
        self._log.debug("Validating the buffer")
        if len(buffer) == 0:
            self._log.debug("Buffer was empty")
            if self._conn.isOpen():
                self._log.debug('Closing connection')
                self._conn.close()
            return False
        p0 = hex2int(buffer[0])
        p1 = hex2int(buffer[1])
        checksum = sum([hex2int(c) for c in buffer[:35]]) & 0xFF
        p35 = hex2int(buffer[35])
        if p0 != 165 or p1 != 150 or p35 != checksum:
            self._log.debug("Buffer checksum was not valid")
            return False
        return True
789175
def check_proper_status(hsh)
      proper = hsh[:proper]
      proper_f = hsh[:proper_f]
      status = 'invalid'
      status = proper != proper_f ? 'formatted' : 'unchanged' if proper && proper_f
      hsh[:proper_status] = status if status.present?
      hsh
    end
684625
def get_checksum(self, encoder=base64.b64encode, hasher=hashlib.sha256):
        """"""
        assert self._closed, "Archive not closed"
        with open(self._temp_archive_file.name, 'rb') as fh:
            return encoder(checksum(fh, hasher())).decode('ascii')