import hashlib


def get_file_hash(file_path, block_size=1024, hasher=None):
    """
    Generate hash for given file

    :param file_path: Path to file
    :type file_path: str
    :param block_size: Size of block to be read at once (default: 1024)
    :type block_size: int
    :param hasher: Use specific hasher, defaults to md5 (default: None)
    :type hasher: _hashlib.HASH
    :return: Hash of file
    :rtype: str
    """
    if hasher is None:
        hasher = hashlib.md5()
    with open(file_path, 'rb') as f:
        while True:
            buffer = f.read(block_size)
            if len(buffer) <= 0:
                break
            hasher.update(buffer)
    return hasher.hexdigest()