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='')
| 199 | |
| 200 | |
| 201 | def new(key, msg=None, digestmod=''): |
| 202 | """Create a new hashing object and return it. |
| 203 | |
| 204 | key: bytes or buffer, The starting key for the hash. |
| 205 | msg: bytes or buffer, Initial input for the hash, or None. |
| 206 | digestmod: A hash name suitable for hashlib.new(). *OR* |
| 207 | A hashlib constructor returning a new hash object. *OR* |
| 208 | A module supporting PEP 247. |
| 209 | |
| 210 | Required as of 3.8, despite its position after the optional |
| 211 | msg argument. Passing it as a keyword argument is |
| 212 | recommended, though not required for legacy API reasons. |
| 213 | |
| 214 | You can now feed arbitrary bytes into the object using its update() |
| 215 | method, and can ask for the hash value at any time by calling its digest() |
| 216 | or hexdigest() methods. |
| 217 | """ |
| 218 | return HMAC(key, msg, digestmod) |
| 219 | |
| 220 | |
| 221 | def digest(key, msg, digest): |