ž ĐĸfXc@sdZddlZddlmZedd„edƒDƒƒZedd„edƒDƒƒZ dZ Gdd „d ƒZ ddd d „Z dS( uxHMAC (Keyed-Hashing for Message Authentication) Python module. Implements the HMAC algorithm as described by RFC 2104. iN(u_compare_digestccs|]}|dAVqdS(i\N((u.0ux((u)/opt/alt/python33/lib64/python3.3/hmac.pyu su iccs|]}|dAVqdS(i6N((u.0ux((u)/opt/alt/python33/lib64/python3.3/hmac.pyu scBsn|EeZdZdZdZdddd„Zdd„Zdd„Zd d „Z d d „Z d d„Z dS(uHMACu~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). i@csūt|tƒs+tdt|ƒjƒ‚nˆdkrOddl}|j‰ntˆƒrgˆ|_ nd‡fdd†|_ |j ƒ|_ |j ƒ|_ |j j |_ t |j dƒr|j j}|dkr(tjd ||jftd ƒ|j}q(n#tjd |jtd ƒ|j}t|ƒ|krR|j |ƒjƒ}n|t|t|ƒƒ}|j j|jtƒƒ|j j|jtƒƒ|dk rš|j|ƒndS( ukCreate a new HMAC object. key: key for the keyed hash object. msg: Initial input for the hash, if provided. digestmod: A module supporting PEP 247. *OR* A hashlib constructor returning a new hash object. Defaults to hashlib.md5. Note: key and msg must be bytes objects. ukey: expected bytes, but got %riNscs ˆj|ƒS(N(unew(ud(u digestmod(u)/opt/alt/python33/lib64/python3.3/hmac.pyu/suHMAC.__init__..u block_sizeiu:block_size of %d seems too small; using our default of %d.iu<No block_size attribute on given digest object; Assuming %d.(u isinstanceubytesu TypeErrorutypeu__name__uNoneuhashlibumd5ucallableu digest_consuouteruinneru digest_sizeuhasattru block_sizeu _warningsuwarnu blocksizeuRuntimeWarningulenudigestuupdateu translateutrans_5Cutrans_36(uselfukeyumsgu digestmoduhashlibu blocksize((u digestmodu)/opt/alt/python33/lib64/python3.3/hmac.pyu__init__s:               u HMAC.__init__cCs?t|tƒs+tdt|ƒjƒ‚n|jj|ƒdS(u8Update this hashing object with the string msg. uexpected bytes, but got %rN(u isinstanceubytesu TypeErrorutypeu__name__uinneruupdate(uselfumsg((u)/opt/alt/python33/lib64/python3.3/hmac.pyuupdateKsu HMAC.updatecCsU|jj|jƒ}|j|_|j|_|jjƒ|_|jjƒ|_|S(uyReturn a separate copy of this hashing object. An update to this copy won't affect the original object. (u __class__u__new__u digest_consu digest_sizeuinnerucopyuouter(uselfuother((u)/opt/alt/python33/lib64/python3.3/hmac.pyucopyRs   u HMAC.copycCs)|jjƒ}|j|jjƒƒ|S(uwReturn a hash object for the current state. To be used only internally with digest() and hexdigest(). (uouterucopyuupdateuinnerudigest(uselfuh((u)/opt/alt/python33/lib64/python3.3/hmac.pyu_current_su HMAC._currentcCs|jƒ}|jƒS(uöReturn the hash value of this hashing object. This returns a string containing 8-bit data. The object is not altered in any way by this function; you can continue updating the object after calling this function. (u_currentudigest(uselfuh((u)/opt/alt/python33/lib64/python3.3/hmac.pyudigesths u HMAC.digestcCs|jƒ}|jƒS(uKLike digest(), but returns a string of hexadecimal digits instead. (u_currentu hexdigest(uselfuh((u)/opt/alt/python33/lib64/python3.3/hmac.pyu hexdigestrs uHMAC.hexdigestN( u__name__u __module__u __qualname__u__doc__u blocksizeuNoneu__init__uupdateucopyu_currentudigestu hexdigest(u __locals__((u)/opt/alt/python33/lib64/python3.3/hmac.pyuHMACs2  uHMACcCst|||ƒS(uVCreate 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. (uHMAC(ukeyumsgu digestmod((u)/opt/alt/python33/lib64/python3.3/hmac.pyunewxs unew(u__doc__uwarningsu _warningsuoperatoru_compare_digestucompare_digestubytesurangeutrans_5Cutrans_36uNoneu digest_sizeuHMACunew(((u)/opt/alt/python33/lib64/python3.3/hmac.pyus f