belel-protocol / verifier /core /canonical.py
TTOPM's picture
Upload 313 files
6b53875 verified
Raw History Blame Contribute Delete
230 Bytes
import json, hashlib
def canonical_json(obj) -> bytes:
return json.dumps(obj, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")
def sha256hex(b: bytes) -> str:
return hashlib.sha256(b).hexdigest()