import hashlib
import json
import base64


def hash_dict(obj):
    """
    Hashes the json representation of obj using sha-256 to have almost certain uniqueness.
    @param obj: dict to be hashed
    @return: sha256 b64 encoded hash of the dict
    """
    m = hashlib.sha256()
    s = json.dumps(obj, sort_keys=True)
    m.update(bytes(s, 'utf-8'))
    return base64.b64encode(m.digest()).decode('utf-8')