Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
HMAC Class Reference

Public Member Functions

def __init__
 

Data Fields

 digestmod
 
 outer
 
 inner
 
 digest_size
 

Detailed Description

RFC2104 HMAC class.

This supports the API for Cryptographic Hash Functions (PEP 247).

Definition at line 17 of file hmac.py.

Constructor & Destructor Documentation

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. Defaults to the md5 module.

Definition at line 23 of file hmac.py.

23 
24  def __init__(self, key, msg = None, digestmod = None):
25  """Create a new HMAC object.
26 
27  key: key for the keyed hash object.
28  msg: Initial input for the hash, if provided.
29  digestmod: A module supporting PEP 247. Defaults to the md5 module.
30  """
31  if digestmod == None:
32  import md5
33  digestmod = md5
34 
35  self.digestmod = digestmod
36  self.outer = digestmod.new()
37  self.inner = digestmod.new()
38  self.digest_size = digestmod.digest_size
39 
40  blocksize = 64
41  ipad = "\x36" * blocksize
42  opad = "\x5C" * blocksize
43 
44  if len(key) > blocksize:
45  key = digestmod.new(key).digest()
46 
47  key = key + chr(0) * (blocksize - len(key))
48  self.outer.update(_strxor(key, opad))
49  self.inner.update(_strxor(key, ipad))
50  if (msg):
51  self.update(msg)

Field Documentation

digest_size

Definition at line 37 of file hmac.py.

digestmod

Definition at line 34 of file hmac.py.

inner

Definition at line 36 of file hmac.py.

outer

Definition at line 35 of file hmac.py.


The documentation for this class was generated from the following file: