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='')
| 211 | |
| 212 | |
| 213 | def 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 | |
| 233 | def digest(key, msg, digest): |