parameters: (self, key, msg = None, digestmod = None)
docstring: 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.  *OR*
                     A hashlib constructor returning a new hash object.
                     Defaults to hashlib.md5.
docstring_summary: Create a new HMAC object.
docstring_tokens: Create a new HMAC object .
function: def __init__(self, key, msg = None, digestmod = None):
          """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.  *OR*
                     A hashlib constructor returning a new hash object.
                     Defaults to hashlib.md5.
          """
  
          if key is _secret_backdoor_key: # cheap
              return
  
          if digestmod is None:
              import hashlib
              digestmod = hashlib.md5
  
          if hasattr(digestmod, '__call__'):
              self.digest_cons = digestmod
          else:
              self.digest_cons = lambda d='': digestmod.new(d)
  
          self.outer = self.digest_cons()
          self.inner = self.digest_cons()
          self.digest_size = self.inner.digest_size
  
          if hasattr(self.inner, 'block_size'):
              blocksize = self.inner.block_size
              if blocksize < 16:
                  # Very low blocksize, most likely a legacy value like
                  # Lib/sha.py and Lib/md5.py have.
                  _warnings.warn('block_size of %d seems too small; using our '
                                 'default of %d.' % (blocksize, self.blocksize),
                                 RuntimeWarning, 2)
                  blocksize = self.blocksize
          else:
              _warnings.warn('No block_size attribute on given digest object; '
                             'Assuming %d.' % (self.blocksize),
                             RuntimeWarning, 2)
              blocksize = self.blocksize
  
          if len(key) > blocksize:
              key = self.digest_cons(key).digest()
  
          key = key + chr(0) * (blocksize - len(key))
          self.outer.update(key.translate(trans_5C))
          self.inner.update(key.translate(trans_36))
          if msg is not None:
              self.update(msg)
function_tokens: def __init__ ( self , key , msg = None , digestmod = None ) : if key is _secret_backdoor_key : # cheap return if digestmod is None : import hashlib digestmod = hashlib . md5 if hasattr ( digestmod , '__call__' ) : self . digest_cons = digestmod else : self . digest_cons = lambda d = '' : digestmod . new ( d ) self . outer = self . digest_cons ( ) self . inner = self . digest_cons ( ) self . digest_size = self . inner . digest_size if hasattr ( self . inner , 'block_size' ) : blocksize = self . inner . block_size if blocksize < 16 : # Very low blocksize, most likely a legacy value like # Lib/sha.py and Lib/md5.py have. _warnings . warn ( 'block_size of %d seems too small; using our ' 'default of %d.' % ( blocksize , self . blocksize ) , RuntimeWarning , 2 ) blocksize = self . blocksize else : _warnings . warn ( 'No block_size attribute on given digest object; ' 'Assuming %d.' % ( self . blocksize ) , RuntimeWarning , 2 ) blocksize = self . blocksize if len ( key ) > blocksize : key = self . digest_cons ( key ) . digest ( ) key = key + chr ( 0 ) * ( blocksize - len ( key ) ) self . outer . update ( key . translate ( trans_5C ) ) self . inner . update ( key . translate ( trans_36 ) ) if msg is not None : self . update ( msg )