U ,a@sdZddlZddlmZz ddlZWnek r@dZdZ Yn Xe ej Z ddl Ze ddedDZe ddedDZdZGdd d Zdd d Zd dZdS)zqHMAC (Keyed-Hashing for Message Authentication) module. Implements the HMAC algorithm as described by RFC 2104. N)_compare_digestccs|]}|dAVqdS)\N.0xrr)/opt/alt/python38/lib64/python3.8/hmac.py sr ccs|]}|dAVqdS)6Nrrrrrr sc@sReZdZdZdZdddZeddZd d Zd d Z d dZ ddZ ddZ dS)HMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). @NcsFt|ttfs tdt|js,tdtr<|_n,ttrXdfdd |_ndfdd |_||_ ||_ |j j |_ t |j dr|j j }|dkrtd ||jftd |j}ntd |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|SN_hashlibnewd digestmodrr8rzHMAC.__init__..cs |Srrrrrrr:r block_sizez:block_size of %d seems too small; using our default of %d.z.cs |SrrrrGrrrrrr r)r)r) _hashopensslrr&_openssl_md_methsZ hmac_digestr$getattrr/r0r2r3r5r4)r7r8r0r%r(r'r-rrGrr0s,      r0)Nr)rEwarningsr+ _operatorrZcompare_digestrrH ImportErrorrI frozensetZopenssl_md_meth_namesZhashlibrranger4r5r)r rr0rrrrs    n