MCPcopy Index your code
hub / github.com/python/cpython / new

Function new

Lib/hmac.py:213–230  ·  view source on GitHub ↗

Create a new hashing object and return it. key: bytes or buffer, The starting key for the hash. msg: bytes or buffer, Initial input for the hash, or None. digestmod: A hash name suitable for hashlib.new(). *OR* A hashlib constructor returning a new hash object. *OR*

(key, msg=None, digestmod='')

Source from the content-addressed store, hash-verified

211
212
213def new(key, msg=None, digestmod=''):
214 """Create a new hashing object and return it.
215
216 key: bytes or buffer, The starting key for the hash.
217 msg: bytes or buffer, Initial input for the hash, or None.
218 digestmod: A hash name suitable for hashlib.new(). *OR*
219 A hashlib constructor returning a new hash object. *OR*
220 A module supporting PEP 247.
221
222 Required as of 3.8, despite its position after the optional
223 msg argument. Passing it as a keyword argument is
224 recommended, though not required for legacy API reasons.
225
226 You can now feed arbitrary bytes into the object using its update()
227 method, and can ask for the hash value at any time by calling its digest()
228 or hexdigest() methods.
229 """
230 return HMAC(key, msg, digestmod)
231
232
233def digest(key, msg, digest):

Callers 3

file_digestFunction · 0.85
__new__Method · 0.85
test_newMethod · 0.85

Calls 1

HMACClass · 0.85

Tested by 2

__new__Method · 0.68
test_newMethod · 0.68