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

Data Structures

class  HMAC
 

Functions

def update
 def clear(self): raise NotImplementedError, "clear() method not available in HMAC." More...
 
def copy
 
def digest
 
def hexdigest
 
def new
 

Variables

 digest_size = None
 

Detailed Description

HMAC (Keyed-Hashing for Message Authentication) Python module.

Implements the HMAC algorithm as described by RFC 2104.

Function Documentation

def hmac.copy (   self)
Return a separate copy of this hashing object.

An update to this copy won't affect the original object.

Definition at line 60 of file hmac.py.

60 
61  def copy(self):
62  """Return a separate copy of this hashing object.
63 
64  An update to this copy won't affect the original object.
65  """
66  other = HMAC("")
67  other.digestmod = self.digestmod
68  other.inner = self.inner.copy()
69  other.outer = self.outer.copy()
70  return other
def hmac.digest (   self)
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.

Definition at line 71 of file hmac.py.

71 
72  def digest(self):
73  """Return the hash value of this hashing object.
74 
75  This returns a string containing 8-bit data. The object is
76  not altered in any way by this function; you can continue
77  updating the object after calling this function.
78  """
79  h = self.outer.copy()
80  h.update(self.inner.digest())
81  return h.digest()
def hmac.hexdigest (   self)
Like digest(), but returns a string of hexadecimal digits instead.

Definition at line 82 of file hmac.py.

References dospath.join(), log_faction_ships.tuple, and string.zfill().

82 
83  def hexdigest(self):
84  """Like digest(), but returns a string of hexadecimal digits instead.
85  """
86  return "".join([string.zfill(hex(ord(x))[2:], 2)
87  for x in tuple(self.digest())])
def hmac.new (   key,
  msg = None,
  digestmod = None 
)
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.

Definition at line 88 of file hmac.py.

88 
89 def new(key, msg = None, digestmod = None):
90  """Create a new hashing object and return it.
91 
92  key: The starting key for the hash.
93  msg: if available, will immediately be hashed into the object's starting
94  state.
95 
96  You can now feed arbitrary strings into the object using its update()
97  method, and can ask for the hash value at any time by calling its digest()
98  method.
99  """
100  return HMAC(key, msg, digestmod)
def hmac.update (   self,
  msg 
)

def clear(self): raise NotImplementedError, "clear() method not available in HMAC."

Update this hashing object with the string msg.

Definition at line 55 of file hmac.py.

55 
56  def update(self, msg):
57  """Update this hashing object with the string msg.
58  """
59  self.inner.update(msg)

Variable Documentation

digest_size = None

Definition at line 15 of file hmac.py.