import hashlib
import base64


def get_file_hash(filename, algorithm='md5'):
    """Linux equivalent: openssl <algorithm> -binary <filename> | base64"""
    hash_obj = getattr(hashlib, algorithm)()
    with open(filename, 'rb') as file_:
        for chunk in iter(lambda: file_.read(1024), b""):
            hash_obj.update(chunk)
    file_hash = hash_obj.digest()
    file_hash = base64.b64encode(file_hash).decode()
    return file_hash