a ÕDOg[ã@s¬dZddlZz ddlZWn&ey>dZdZddlmZ Yn0e ej ƒZej Z ddl Ze dd„edƒDƒƒZe dd„edƒDƒƒZdZGdd „d ƒZdd d „Zd d„ZdS)zqHMAC (Keyed-Hashing for Message Authentication) module. Implements the HMAC algorithm as described by RFC 2104. éN)Ú_compare_digestccs|]}|dAVqdS)é\N©©Ú.0Úxrrú)/opt/alt/python39/lib64/python3.9/hmac.pyÚ ór éccs|]}|dAVqdS)é6Nrrrrrr r c@szeZdZdZdZdZddd„Zedd „ƒZed d „ƒZ ed d „ƒZ edd„ƒZ dd„Z dd„Z dd„Zdd„Zdd„ZdS)ÚHMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). é@)Ú _digest_consÚ_innerÚ_outerÚ block_sizeÚ digest_sizeNÚcsFt|ttfƒs tdt|ƒjƒ‚ˆs,tdƒ‚tˆƒr<ˆ|_n,tˆtƒrXd‡fdd„ |_nd‡fdd„ |_| ¡|_ | ¡|_ |j j |_ t |j dƒrÂ|j j }|dkrÜt d ||jftd ¡|j}nt d |jtd ¡|j}||_ t|ƒ|krþ| |¡ ¡}| |d ¡}|j  | t¡¡|j  | t¡¡|d urB| |¡d S)a?Create a new HMAC object. key: bytes or buffer, key for the keyed hash object. 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* A module supporting PEP 247. Required as of 3.8, despite its position after the optional msg argument. Passing it as a keyword argument is recommended, though not required for legacy API reasons. z,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.r cs t ˆ|¡S©N©Ú_hashlibÚnew©Úd©Ú digestmodrrÚ=r zHMAC.__init__..cs ˆ |¡Sr©rrrrrr?r réz:block_size of %d seems too small; using our default of %d.ézr2rArEr0rFrrrrr s" 9       r rcCs t|||ƒS)aá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* A module supporting PEP 247. Required as of 3.8, despite its position after the optional msg argument. Passing it as a keyword argument is recommended, though not required for legacy API reasons. You can now feed arbitrary bytes into the object using its update() method, and can ask for the hash value at any time by calling its digest() or hexdigest() methods. )r )r7r8rrrrr™srcsâtdur(tˆtƒr(ˆtvr(t ||ˆ¡Stˆƒr6ˆ}n(tˆtƒrPd ‡fdd„ }nd ‡fdd„ }|ƒ}|ƒ}t|ddƒ}t|ƒ|krŽ||ƒ ¡}|d|t|ƒ}|  |  t ¡¡|  |  t ¡¡|  |¡|  | ¡¡| ¡S) aJFast inline implementation of HMAC. key: bytes or buffer, The key for the keyed hash object. msg: bytes or buffer, 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. Nr cs t ˆ|¡Srrr©r0rrr½r zdigest..cs ˆ |¡SrrrrLrrr¿r rrr!)r )r ) Ú _hashopensslr"r)Ú_openssl_md_methsZ hmac_digestr(Úgetattrr/r0r2r3r5r4)r7r8r0r<r=r>r-rrLrr0­s, ÿÿ     r0)Nr)rIÚwarningsr+rrMÚ ImportErrorrNÚ _operatorrZcompare_digestÚ frozensetZopenssl_md_meth_namesZhashlibr#Úranger4r5rr rr0rrrrÚs    ~