frimeet-api-nlp / app /shared /content_hash.py
AlleksDev's picture
Deploy Frimeet API NLP
45b1179
Raw
History Blame Contribute Delete
304 Bytes
import hashlib
import json
from typing import Any
def stable_content_hash(payload: dict[str, Any]) -> str:
encoded = json.dumps(
payload,
ensure_ascii=False,
sort_keys=True,
separators=(",", ":"),
).encode("utf-8")
return hashlib.sha256(encoded).hexdigest()