Verifies the MD5 checksum.
        Only used in the __init__() function
485438
def _md5_validation(self) -> bool:
        '''
        
        '''
        fn = self.file if self.compressed_file is None else self.compressed_file

        md5 = hashlib.md5()
        block_size = 16384
        with fn.open('rb') as f:
            f.seek(-16, 2)
            remaining = f.tell()  # File size minus checksum size
            f.seek(0)
            while (remaining > block_size):
                data = f.read(block_size)
                remaining = remaining - block_size
                md5.update(data)

            if (remaining > 0):
                data = f.read(remaining)
                md5.update(data)

            existing_md5 = f.read(16).hex()

        return md5.hexdigest() == existing_md5
755037
function verifyChecksum(fileName, checksum) {
  return kew.resolve(hasha.fromFile(fileName, {algorithm: 'sha256'})).then(function (hash) {
    var result = checksum == hash
    if (result) {
      console.log('Verified checksum of previously downloaded file')
    } else {
      console.log('Checksum did not match')
    }
    return result
  }).fail(function (err) {
    console.error('Failed to verify checksum: ', err)
    return false
  })
}
31581
def verify(password, hash):
    
    _, algorithm, cost, salt, password_hash = hash.split("$")

    password = pbkdf2.pbkdf2_hex(password, salt, int(cost) * 500)

    return _safe_str_cmp(password, password_hash)
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
510201
def _checksum(in_file, block_size=65536):
    
    cs = hashlib.sha256()
    with open(in_file, "rb") as f:
        for block in iter(lambda: f.read(block_size), b''):
            cs.update(block)
    return cs.hexdigest()
369892
function md5 (str) {
    if (!str) str = '';
    const h = crypto.createHash('md5');
    return h.update(str).digest('hex');
}
449195
public function verifyChecksum()
    {
        if(empty($this->getPackage()->getChecksum())) {
            return true;
        }
        return $this->getPackage()->getChecksum() === md5_file($this->getDownloadFullPath());
    }
824994
def checksums(self, install):
        
        check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
7760
def md5sum(fname, block_size=1048576):  # 2 ** 20
    
    md5 = hashlib.md5()
    with open(fname, 'rb') as fid:
        while True:
            data = fid.read(block_size)
            if not data:
                break
            md5.update(data)
    return md5.hexdigest()
52637
def checksum(path, hashfunc='md5'):
    
    import checksumdir
    hash_func = checksumdir.HASH_FUNCS.get(hashfunc)
    if not hash_func:
        raise NotImplementedError('{} not implemented.'.format(hashfunc))

    if os.path.isdir(path):
        return checksumdir.dirhash(path, hashfunc=hashfunc)

    hashvalues = []
    path_list = glob.glob(path)
    logger.debug("path_list " + str(path_list))
    for path in path_list:
        if os.path.isfile(path):
            hashvalues.append(checksumdir._filehash(path, hashfunc=hash_func))
    logger.debug(str(hashvalues))
    hash = checksumdir._reduce_hash(hashvalues, hashfunc=hash_func)
    return hash
1045645
def compare_checksum(info, f):
    
    pieces = info['pieces']

    def getchunks(f, size):
        while True:
            chunk = f.read(size)
            if chunk == '':
                break
            yield hashlib.sha1(chunk).digest()

    calc = getchunks(f, info['piece length'])
    ref = (pieces[i:i + 20] for i in xrange(0, len(pieces), 20))
    for expected, actual in itertools.izip(calc, ref):
        if expected != actual:
            return False
    return ensure_empty(calc) and ensure_empty(ref)
356320
def md5(self):
        
        hasher = hashlib.md5()
        for key in sorted(self.data.keys()):
            hasher.update(self.data[key].md5().encode('utf-8'))
        md5 = hasher.hexdigest()
        return md5
976293
def checksum_chain(self):
        

        checksums = []
        for certificate in self.certificates:
            checksums.append(certificate.checksum)

        return "::".join(checksums)
1209658
def md5(self, raw_output=False):
        
        res = hashlib.md5(str(self.generator.random.random()).encode('utf-8'))
        if raw_output:
            return res.digest()
        return res.hexdigest()
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")
471797
def checksum(self):
        
        total = 0

        # Add together all bytes
        for byte in self.data:
            total += byteToInt(byte)

        # Only keep the last byte
        total = total & 0xFF

        return intToByte(0xFF - total)
764407
def _valid_packet(raw_packet):
        """"""
        if raw_packet[0:1] != b'\xcc':
            return False
        if len(raw_packet) != 19:
            return False
        checksum = 0
        for i in range(1, 17):
            checksum += raw_packet[i]
        if checksum != raw_packet[18]:
            return False
        return True