C# Class ImageTools.CRC32Calculator

Show file Open project: prepare/HTML-Renderer Class Usage Examples

Public Methods

Method Description
CRC32Calculator ( ) : System
CalculateCrc32 ( byte buffer ) : int
CalculateCrc32 ( string inputData ) : int
Combine ( int crc, int length ) : void

Combines the given CRC32 value with the current running total.

This is useful when using a divide-and-conquer approach to calculating a CRC. Multiple threads can each calculate a CRC32 on a segment of the data, and then combine the individual CRC32 values at the end.

Reset ( ) : void

reset before reuse

SlurpBlock ( byte block ) : void
SlurpBlock ( byte block, int offset, int count ) : void

Update the value for the running CRC32 using the given block of bytes. This is useful when using the CRC32() class in a Stream.

Private Methods

Method Description
ComputeCrc32 ( Int32 W, byte B ) : Int32

Get the CRC32 for the given (word,byte) combo. This is a computation defined by PKzip.

_InternalComputeCrc32 ( UInt32 W, byte B ) : Int32
gf2_matrix_square ( uint square, uint mat ) : void
gf2_matrix_times ( uint matrix, uint vec ) : uint

Method Details

CRC32Calculator() public method

public CRC32Calculator ( ) : System
return System

CalculateCrc32() public static method

public static CalculateCrc32 ( byte buffer ) : int
buffer byte
return int

CalculateCrc32() public static method

public static CalculateCrc32 ( string inputData ) : int
inputData string
return int

Combine() public method

Combines the given CRC32 value with the current running total.
This is useful when using a divide-and-conquer approach to calculating a CRC. Multiple threads can each calculate a CRC32 on a segment of the data, and then combine the individual CRC32 values at the end.
public Combine ( int crc, int length ) : void
crc int the crc value to be combined with this one
length int the length of data the CRC value was calculated on
return void

Reset() public method

reset before reuse
public Reset ( ) : void
return void

SlurpBlock() public method

public SlurpBlock ( byte block ) : void
block byte
return void

SlurpBlock() public method

Update the value for the running CRC32 using the given block of bytes. This is useful when using the CRC32() class in a Stream.
public SlurpBlock ( byte block, int offset, int count ) : void
block byte block of bytes to slurp
offset int starting point in the block
count int how many bytes within the block to slurp
return void