\d%"dZddlZ ddlZejZeejZn#e $r dZdZddl m ZYnwxYwddl Ze dedDZe dedDZdZGddZd d Zd ZdS) zqHMAC (Keyed-Hashing for Message Authentication) module. Implements the HMAC algorithm as described by RFC 2104. N)_compare_digestc# K|] }|dz V dS)\N.0xs ..\python\lib\hmac.py r &00!d(000000c# K|] }|dz V dS)6Nrrs r r r r r cbeZdZdZdZdZddZdZdZe d Z d Z d Z d Z d ZdZdS)HMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). @)_hmac_inner_outer block_size digest_sizeNct|ttfs$tdt |jz|stdt rct|ttfrG | |||dS#t j $r| |||YdSwxYw| |||dS)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'.N) isinstancebytes bytearray TypeErrortype__name__ _hashopensslstr _functype _init_hmacUnsupportedDigestmodError _init_oldselfkeymsg digestmods r __init__z HMAC.__init__&s#y122 aJTRUYYM__`` ` GEFF F  0Jy3 2BCC 0 4S)444449 4 4 4sC333333 4 NN3Y / / / / /s6B&B98B9ctj||||_|jj|_|jj|_dS)N)r+)r!hmac_newrrrr's r r$zHMAC._init_hmacBs8!*3yIII :1*/r cltr}n"ttrd fd }nd fd }d|_||_||_|jj|_t|jdr?|jj}|dkr,tj d||j fztd|j }n*tj d|j ztd|j }t||kr||}||_||d }|j|t$|j|t&|||dSdS) Nr c.tj|SN_hashlibnewdr+s r z HMAC._init_old..Ks Y(B(Br c.|Sr1r4r5s r r7z HMAC._init_old..Ms a(8(8r rz:block_size of %d seems too small; using our default of %d.z.sHL$;$;r c.|Sr1r9res r r7zdigest..sFJJqMMr rrr<r=)r!rr"r# hmac_digestr%r>getattrrDrErGrHrJrI)r)r*rErKinnerouterrBs ` r rErEsJvY7G$H$H +Cf== =5    D 2 FC 2;;;;; 11111 KMME KMME|R00I 3xx)k#%%'' 9s3xx/0 0C LLx(())) LLx(())) LL LL   <<>>s<A Ar\)r_warningsr@r3r!compare_digestropenssl_sha256r# ImportError _operatorrhashlibrrangerIrJrrr4rErr r rrsJ 2#### "0N\011II <<<LI;;;;;;;;< 500UU3ZZ000 0 0 500UU3ZZ000 0 0 JJJJJJJJX%%%%(     s $66