new(name, data=b'') - Return a new hashing object using the named algorithm; optionally initialized with data (which must be a bytes-like object).
(name, *args, **kwargs)
| 150 | |
| 151 | |
| 152 | def __hash_new(name, *args, **kwargs): |
| 153 | """new(name, data=b'') - Return a new hashing object using the named algorithm; |
| 154 | optionally initialized with data (which must be a bytes-like object). |
| 155 | """ |
| 156 | if name in __block_openssl_constructor: |
| 157 | # Prefer our builtin blake2 implementation. |
| 158 | return __get_builtin_constructor(name)(*args, **kwargs) |
| 159 | try: |
| 160 | return _hashlib.new(name, *args, **kwargs) |
| 161 | except ValueError: |
| 162 | # If the _hashlib module (OpenSSL) doesn't support the named |
| 163 | # hash, try using our builtin implementations. |
| 164 | # This allows for SHA224/256 and SHA384/512 support even though |
| 165 | # the OpenSSL library prior to 0.9.8 doesn't provide them. |
| 166 | return __get_builtin_constructor(name)(*args, **kwargs) |
| 167 | |
| 168 | |
| 169 | try: |
nothing calls this directly
no test coverage detected