Package sulley :: Module blocks :: Class checksum
[show private | hide private]
[frames | no frames]

Class checksum


Method Summary
  __init__(self, block_name, request, algorithm, length, endian, name)
Create a checksum block bound to the block with the specified name.
Raw checksum(self, data)
Calculate and return the checksum (in raw bytes) over the supplied data.
  render(self)
Calculate the checksum of the specified block using the specified algorithm.

Class Variable Summary
dict checksum_lengths = {'crc32': 4, 'sha1': 20, 'adler32': 4...

Method Details

__init__(self, block_name, request, algorithm='crc32', length=0, endian='<', name=None)
(Constructor)

Create a checksum block bound to the block with the specified name. You *can not* create a checksm for any currently open blocks.
Parameters:
block_name - Name of block to apply sizer to
           (type=String)
request - Request this block belongs to
           (type=s_request)
algorithm - (Optional, def=crc32) Checksum algorithm to use. (crc32, adler32, md5, sha1)
           (type=String)
length - (Optional, def=0) Length of checksum, specify 0 to auto-calculate
           (type=Integer)
endian - (Optional, def=LITTLE_ENDIAN) Endianess of the bit field (LITTLE_ENDIAN: <, BIG_ENDIAN: >)
           (type=Character)
name - Name of this checksum field
           (type=String)

checksum(self, data)

Calculate and return the checksum (in raw bytes) over the supplied data.
Parameters:
data - Rendered block data to calculate checksum over.
           (type=Raw)
Returns:
Checksum.
           (type=Raw)

render(self)

Calculate the checksum of the specified block using the specified algorithm.

Class Variable Details

checksum_lengths

Type:
dict
Value:
{'crc32': 4, 'sha1': 20, 'adler32': 4, 'md5': 16}                      

Generated by Epydoc 2.1 on Fri Jul 27 17:40:03 2007 http://epydoc.sf.net