def verify_file(self, st, local_path, remote_path): # hash local file with open(local_path, 'rb') as lfile: m = util.hash_file(lfile, self.hashfunc) remote_hash = self._get_remote_hash(remote_path) log.debug('Local hash: {} Remote hash: {}'.format( m.hexdigest(), remote_hash)) return remote_hash == m.hexdigest()
def _get_hash(self): with self.open('rb') as f: return util.hash_file(f)