Current Path : /usr/lib/python2.7/dist-packages/Crypto/Hash/ |
Current File : //usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyc |
ó T:´Nc @ s^ d Z d Z d d g Z d d l m Z d d l Td Z d d d „ ƒ YZ d d d „ Z d S( sé HMAC (Keyed-Hashing for Message Authentication) Python module. Implements the HMAC algorithm as described by RFC 2104. This is just a copy of the Python 2.2 HMAC module, modified to work when used on versions of Python before 2.2. s $Id$t newt digest_sizeiÿÿÿÿ( t strxor_c( t *t HMACc B sA e Z d Z d d d „ Z d „ Z d „ Z d „ Z d „ Z RS( s_ RFC2104 HMAC class. This supports the API for Cryptographic Hash Functions (PEP 247). c C sK | d k r! d d l } | } n | | _ | j ƒ | _ | j ƒ | _ y | j | _ Wn) t k rƒ t | j j ƒ ƒ | _ n Xy | j } Wn t k rª d } n Xd } d } t | ƒ | k rá | j | ƒ j ƒ } n | t d ƒ | t | ƒ } | j j t | | ƒ ƒ | j j t | | ƒ ƒ | rG| j | ƒ n d S( sÝ Create 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. Defaults to the md5 module. iÿÿÿÿNi@ i6 i\ i ( t Nonet MD5t digestmodR t outert innerR t AttributeErrort lent digestt block_sizet bchrt updateR ( t selft keyt msgR R t blocksizet ipadt opad( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyt __init__; s. c C s | j j | ƒ d S( s8 Update this hashing object with the string msg. N( R R ( R R ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyR d s c C sF t t d ƒ ƒ } | j | _ | j j ƒ | _ | j j ƒ | _ | S( sy Return a separate copy of this hashing object. An update to this copy won't affect the original object. t ( R t bR R t copyR ( R t other( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyR i s c C s/ | j j ƒ } | j | j j ƒ ƒ | j ƒ S( sö 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. ( R R R R R ( R t h( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyR t s c C s6 d j g t | j ƒ ƒ D] } d t | ƒ ^ q ƒ S( sK Like digest(), but returns a string of hexadecimal digits instead. R s %02x( t joint tupleR t bord( R t x( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyt hexdigest s N( t __name__t __module__t __doc__R R R R R R ( ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyR 5 s ) c C s t | | | ƒ S( sV Create 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. ( R ( R R R ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyR … s N( ( R# t __revision__t __all__t Crypto.Util.strxorR t Crypto.Util.py3compatR R R R ( ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Hash/HMAC.pyt <module>( s P