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

Class _HashFuncInfo

Lib/test/support/hashlib_helper.py:248–293  ·  view source on GitHub ↗

Dataclass containing information for hash functions constructors. - *canonical_name* must be a _HashId. - *builtin* is the fully-qualified name of the HACL* hash constructor function, e.g., "_md5.md5". - *openssl* is the fully-qualified name of the "_hashlib" method for th

Source from the content-addressed store, hash-verified

246
247
248class _HashFuncInfo(_HashInfoBase):
249 """Dataclass containing information for hash functions constructors.
250
251 - *canonical_name* must be a _HashId.
252
253 - *builtin* is the fully-qualified name of the HACL*
254 hash constructor function, e.g., "_md5.md5".
255
256 - *openssl* is the fully-qualified name of the "_hashlib" method
257 for the OpenSSL named constructor, e.g., "_hashlib.openssl_md5".
258
259 - *hashlib* is the fully-qualified name of the "hashlib" method
260 for the explicit named hash constructor, e.g., "hashlib.md5".
261 """
262
263 def __init__(self, canonical_name, builtin, openssl=None, hashlib=None):
264 super().__init__(canonical_name)
265 self.builtin = _HashInfoItem(builtin, strict=True)
266 self.openssl = _HashInfoItem(openssl, strict=False)
267 self.hashlib = _HashInfoItem(hashlib, strict=False)
268
269 def fullname(self, implementation):
270 """Get the fully qualified name of a given implementation.
271
272 This returns a string of the form "MODULE_NAME.METHOD_NAME" or None
273 if the hash function does not have a corresponding implementation.
274
275 *implementation* must be "builtin", "openssl" or "hashlib".
276 """
277 return self[implementation].fullname
278
279 def module_name(self, implementation):
280 """Get the name of the constructor function module.
281
282 The *implementation* must be "builtin", "openssl" or "hashlib".
283 """
284 return self[implementation].module_name
285
286 def method_name(self, implementation):
287 """Get the name of the constructor function module method.
288
289 Use fullname() to get the constructor function fully-qualified name.
290
291 The *implementation* must be "builtin", "openssl" or "hashlib".
292 """
293 return self[implementation].member_name
294
295
296class _HashInfo:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…