esandorfi's picture
Domain features first reorganisation
68f48a7
raw
history blame contribute delete
283 Bytes
from __future__ import annotations
import hashlib
import json
from typing import Any
def stable_hash(obj: Any) -> str:
canonical = json.dumps(obj, ensure_ascii=False, separators=(",", ":"), sort_keys=True)
return hashlib.sha256(canonical.encode("utf-8")).hexdigest()[:16]