import hashlib

def get_file_hash(file_path, chunk_size=1024) -> str:
    # Calculate the SHA-256 hash of a file
    hasher = hashlib.sha256()
    with open(file_path, 'rb') as f:
        while True:
            data = f.read(chunk_size)
            if not data:
                break
            hasher.update(data)
    return hasher.hexdigest()

def find_duplicate_files(files_in_dir) -> dict:
    # Iterates for duplicate filenames in and between two lists.
    # Returns a filtered list with duplicates by name
    duplicates_by_name = {}
    # Check for duplicate filenames in dir
    for filename, paths in files_in_dir.items():
        if len(paths[0]) > 1: # and paths[1] < 3: # level 1 or 2  not needed if dedupe before level 3 scan
            duplicates_by_name[filename] = (paths[0])
    return duplicates_by_name
