import hashlib


def get_hash(file):
    """
    Computes md5 hash for a file to detect duplicates
    :param file: uploaded file
    :return: Hex hash
    """
    s = hashlib.md5()
    with open(file, 'rb') as f:
        for line in f:
            s.update(line)
    return s.hexdigest()