mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 06:40:48 +08:00
12 lines
304 B
Python
12 lines
304 B
Python
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import json
|
|
|
|
|
|
def digest(data: dict | str) -> str:
|
|
json_str = data if isinstance(data, str) else json.dumps(data, separators=(',', ':'))
|
|
hash_object = hashlib.sha256()
|
|
hash_object.update(json_str.encode())
|
|
return hash_object.hexdigest()
|