C# Class DS4Windows.Crc32Algorithm

Implements a 32-bit CRC hash algorithm compatible with Zip etc.
Crc32 should only be used for backward compatibility with older file formats and algorithms. It is not secure enough for new applications. If you need to call multiple times for the same data either use the HashAlgorithm interface or remember that the result of one Compute call needs to be ~ (XOR) before being passed in as the seed for the next Compute call.
Inheritance: HashAlgorithm
显示文件 Open project: Yohoki/DS4WindowsEx Class Usage Examples

Public Methods

Method Description
CalculateBasicHash ( uint &seed, Array &buffer, int offset, int size ) : uint
CalculateFasterBT78Hash ( uint &seed, Array &buffer, int &start, int &size ) : uint

More optimized CRC-32 algorithm that only works with 78 byte arrays

Compute ( Array buffer ) : uint
Compute ( uint seed, Array buffer ) : uint
Compute ( uint polynomial, uint seed, Array buffer ) : uint
Crc32Algorithm ( ) : System
Crc32Algorithm ( uint polynomial, uint seed ) : System
Initialize ( ) : void
InitializeTable ( uint polynomial ) : uint[]

Protected Methods

Method Description
HashCore ( Array buffer, int start, int length ) : void
HashFinal ( ) : byte[]

Private Methods

Method Description
CalculateHash ( Array table, uint seed, Array buffer, int start, int size ) : uint
UintToBigEndianBytes ( uint uint32 ) : byte[]

Method Details

CalculateBasicHash() public static method

public static CalculateBasicHash ( uint &seed, Array &buffer, int offset, int size ) : uint
seed uint
buffer Array
offset int
size int
return uint

CalculateFasterBT78Hash() public static method

More optimized CRC-32 algorithm that only works with 78 byte arrays
public static CalculateFasterBT78Hash ( uint &seed, Array &buffer, int &start, int &size ) : uint
seed uint
buffer Array
start int
size int
return uint

Compute() public static method

public static Compute ( Array buffer ) : uint
buffer Array
return uint

Compute() public static method

public static Compute ( uint seed, Array buffer ) : uint
seed uint
buffer Array
return uint

Compute() public static method

public static Compute ( uint polynomial, uint seed, Array buffer ) : uint
polynomial uint
seed uint
buffer Array
return uint

Crc32Algorithm() public method

public Crc32Algorithm ( ) : System
return System

Crc32Algorithm() public method

public Crc32Algorithm ( uint polynomial, uint seed ) : System
polynomial uint
seed uint
return System

HashCore() protected method

protected HashCore ( Array buffer, int start, int length ) : void
buffer Array
start int
length int
return void

HashFinal() protected method

protected HashFinal ( ) : byte[]
return byte[]

Initialize() public method

public Initialize ( ) : void
return void

InitializeTable() public static method

public static InitializeTable ( uint polynomial ) : uint[]
polynomial uint
return uint[]