sha(obj, encoding='utf-8', digest=False)[source]#

Shortcut for the standard hashing (SHA) method

Equivalent to hashlib.sha224().

  • obj (any) – the object to be hashed; if not a string, converted to one

  • encoding (str) – the encoding to use

  • digest (bool) – whether to return the hex digest instead of the hash objet


sha1 = sc.sha(dict(foo=1, bar=2), digest=True)
sha2 = sc.sha(dict(foo=1, bar=2), digest=True)
sha3 = sc.sha(dict(foo=1, bar=3), digest=True)
assert sha1 == sha2
assert sha2 != sha3