B ‚Ž\]uã@s¨dZddlZddlmZy ddlZWnek r@dZdZ Yn Xe ej ƒZ ddl Ze dd„edƒDƒƒZe dd„edƒDƒƒZdZGdd „d ƒZdd d „Zd d „ZdS)zxHMAC (Keyed-Hashing for Message Authentication) Python module. Implements the HMAC algorithm as described by RFC 2104. éN)Ú_compare_digestccs|]}|dAVqdS)é\N©)Ú.0Úxrrú /usr/local/lib/python3.7/hmac.pyú sréccs|]}|dAVqdS)é6Nr)rrrrrrsc@sReZdZdZdZddd„Zedd„ƒZdd „Zd d „Z d d „Z dd„Z dd„Z dS)ÚHMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). é@NcsVt|ttfƒs tdt|ƒjƒ‚ˆdkr=rzHMAC.__init__..cs ˆ |¡S)N)r)r)rrrr?rÚ block_sizeéz:block_size of %d seems too small; using our default of %d.z    r cCs t|||ƒS)aVCreate a new hashing object and return it. key: The starting key for the hash. msg: if available, will immediately be hashed into the object's starting state. You can now feed arbitrary strings into the object using its update() method, and can ask for the hash value at any time by calling its digest() method. )r )r2r3rrrrrŽs rcsâtdk r(tˆtƒr(ˆtkr(t ||ˆ¡Stˆƒr6ˆ}n(tˆtƒrPd ‡fdd„ }nd ‡fdd„ }|ƒ}|ƒ}t|ddƒ}t|ƒ|krŽ||ƒ ¡}|d|t|ƒ}|  |  t ¡¡|  |  t ¡¡|  |¡|  | ¡¡| ¡S) aeFast inline implementation of HMAC key: key for the keyed hash object. msg: input message digest: A hash name suitable for hashlib.new() for best performance. *OR* A hashlib constructor returning a new hash object. *OR* A module supporting PEP 247. Note: key and msg must be a bytes or bytearray objects. Nrcs t ˆ|¡S)N)rr)r)r+rrr®rzdigest..cs ˆ |¡S)N)r)r)r+rrr°rrr r)r)r) Ú _hashopensslrr#Ú_openssl_md_methsÚ hmac_digestr!Úgetattrr*r+r-r.r0r/)r2r3r+r"r%r$r(r)r+rr+œs&      r+)NN)r?ÚwarningsrÚ _operatorrÚcompare_digestrrAÚ ImportErrorrBÚ frozensetÚopenssl_md_meth_namesÚhashlibrÚranger/r0r&r rr+rrrrÚs    t