def find_hash_checks(self, torrent, result):
        """
        Uses hash checking to find pieces
        """
        modified_result = False
        pieces = Pieces(torrent)
        
        if self.db.hash_slow_mode:
            logger.info('Slow mode enabled, building hash size table')
            self.db.build_hash_size_table()
        
        start_size = 0
        end_size = 0
        logger.info('Hash scan mode enabled, checking for incomplete files')
        for f in result:
            start_size = end_size
            end_size += f['length']
            
            if f['completed']:
                continue
            
            files_to_check = []
            logger.debug('Building list of file names to match hash with.')
            
            if self.db.hash_size_mode:
                logger.debug('Using hash size mode to find files')
                files_to_check += self.db.find_hash_size(f['length'])
            
            if self.db.hash_name_mode:
                logger.debug('Using hash name mode to find files')
                name = f['path'][-1]
                files_to_check += self.db.find_hash_name(name)
            
            if self.db.hash_slow_mode:
                logger.debug('Using hash slow mode to find files')
                files_to_check += self.db.find_hash_varying_size(f['length'])
            
            logger.debug('Found %i files to check for matching hash' % len(files_to_check))
            
            checked_files = set()
            for db_file in files_to_check:
                if db_file in checked_files:
                    logger.debug(db_file % 'File %s already checked, skipping')
                
                checked_files.add(db_file)
                logger.info('Hash checking %s' % db_file)
                match_start, match_end = pieces.match_file(db_file, start_size, end_size)
                logger.info('We go result for file %s start:%s end:%s' % (db_file, match_start, match_end))
                
                if match_start or match_end: # this file is all-good
                    size = os.path.getsize(db_file)
                    if size != f['length']: # size does not match, need to align file
                        logger.debug('File does not have correct size, need to align it')
                        if match_start and match_end:
                            logger.debug('Need to find alignment in the middle of the file')
                            modification_point = pieces.find_piece_breakpoint(db_file, start_size, end_size)
                        elif match_start:
                            logger.debug('Need to modify from the end of the file')
                            modification_point = min(f['length'], size)
                        elif match_end:
                            logger.debug('Need to modify at the front of the file')
                            modification_point = 0
                        
                        if size > f['length']:
                            modification_action = 'remove'
                        else:
                            modification_action = 'add'
                        
                        f['completed'] = False
                        f['postprocessing'] = ('rewrite', modification_action, modification_point)
                        modified_result = True
                    else:
                        logger.debug('Perfect size, perfect match !')
                        f['completed'] = True
                    
                    f['actual_path'] = db_file
                    break
        
        return modified_result, result
dataset/ETHPy150Open JohnDoee/autotorrent/autotorrent/at.py/AutoTorrent.find_hash_checks/swapped operands of `%`