def hashfile(file_path, hash, key=None, digest_size=None):
    """
    Gets the hash of a file.
    file_path = Absolute path of the file

    Usage:
    
    """
    with open(file_path, 'r') as file:
        contents = file.read()
        contents = ''.join(contents)
        file.close()
    contents = bytes(contents)
    import hashlib
    if hash == 'md5':
        re = hashlib.md5(contents)
        return re.hexdigest()
    elif hash == 'sha256':
        returnEncoded = hashlib.sha256()
        returnEncoded.update(contents)
        return returnEncoded.hexdigest()
    elif hash == 'sha224':
        returnEncoded = hashlib.sha224(contents)
        return returnEncoded.hexdigest()
    elif hash == 'ripemd160':
        returnEncoded = hashlib.new('ripemd160')
        returnEncoded.update(contents)
        return returnEncoded.hexdigest()
    elif hash == 'blake2b':
        h = hashlib.blake2b(key=key, digest_size=digest_size)
        h.update(contents)
        return h.hexdigest()
    elif hash == 'sha512':
        h = hashlib.sha512()
        h.update(contents)
        return h.hexdigest()
    elif hash == 'blake2s':
        h = hashlib.blake2s(key=key, digest_size=digest_size)
        h.update(contents)
        return h.hexdigest()
    else:
        raise SyntaxError(
            'Specify a valid hash (md5, sha256, sha224, ripemd160, blake2b, blake2s or sha512)'
            )
