MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / __init__

Method __init__

src/commoncode/hash.py:43–58  ·  view source on GitHub ↗

Return a hasher, populated with an initial ``msg`` bytes string. Close on the bitsize and hmodule

(self, msg=None, **kwargs)

Source from the content-addressed store, hash-verified

41 """A hasher class that behaves like a hashlib module."""
42
43 def __init__(self, msg=None, **kwargs):
44 """
45 Return a hasher, populated with an initial ``msg`` bytes string.
46 Close on the bitsize and hmodule
47 """
48 # length of binary digest for this hash
49 self.digest_size = bitsize // 8
50
51 # binh = binary hasher module
52 self.binh = hmodule()
53
54 # msg_len = length in bytes of the message hashed
55 self.msg_len = 0
56
57 if msg:
58 self.update(msg)
59
60 def update(self, msg=None):
61 """

Callers

nothing calls this directly

Calls 1

updateMethod · 0.95

Tested by

no test coverage detected