U ×kŠgåã@s¨dZddlZddlmZz ddlZWnek r@dZdZ Yn Xe ej ƒ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ú/usr/lib/python3.8/hmac.pyÚ sr éccs|]}|dAVqdS)é6Nrrrrrr sc@sReZdZdZdZddd„Zedd„ƒZd d „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). é@NÚ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 k rB| |¡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'.ócs t ˆ|¡S©N©Ú_hashlibÚnew©Úd©Ú digestmodrrÚ8rzHMAC.__init__..cs ˆ |¡Sr©rrrrrr:rÚ block_sizeéz:block_size of %d seems too small; using our default of %d.éz.cs ˆ |¡SrrrrGrrr®rrr r)r)r) Ú _hashopensslrr&Ú_openssl_md_methsZ hmac_digestr$Úgetattrr/r0r2r3r5r4)r7r8r0r%r(r'r-rrGrr0œs, ÿÿ     r0)Nr)rEÚwarningsr+Ú _operatorrZcompare_digestrrHÚ ImportErrorrIÚ frozensetZopenssl_md_meth_namesZhashlibrÚranger4r5r)r rr0rrrrÚs    n