C# 클래스 Crisis.Ionic.Crc.CRC32

파일 보기 프로젝트 열기: teeknofil/Crisis-Wordlist-Generator 1 사용 예제들

공개 메소드들

메소드 설명
CRC32 ( ) : System

Create an instance of the CRC32 class using the default settings: no bit reversal, and a polynomial of 0xEDB88320.

CRC32 ( bool reverseBits ) : System

Create an instance of the CRC32 class, specifying whether to reverse data bits or not.

In the CRC-32 used by BZip2, the bits are reversed. Therefore if you want a CRC32 with compatibility with BZip2, you should pass true here. In the CRC-32 used by GZIP and PKZIP, the bits are not reversed; Therefore if you want a CRC32 with compatibility with those, you should pass false.

CRC32 ( int polynomial, bool reverseBits ) : System

Create an instance of the CRC32 class, specifying the polynomial and whether to reverse data bits or not.

In the CRC-32 used by BZip2, the bits are reversed. Therefore if you want a CRC32 with compatibility with BZip2, you should pass true here for the reverseBits parameter. In the CRC-32 used by GZIP and PKZIP, the bits are not reversed; Therefore if you want a CRC32 with compatibility with those, you should pass false for the reverseBits parameter.

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.

ComputeCrc32 ( Int32 W, byte B ) : Int32

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

GetCrc32 ( System input ) : Int32

Returns the CRC32 for the specified stream.

GetCrc32AndCopy ( System input, System output ) : Int32

Returns the CRC32 for the specified stream, and writes the input into the output stream.

Reset ( ) : void

Reset the CRC-32 class - clear the CRC "remainder register."

Use this when employing a single instance of this class to compute multiple, distinct CRCs on multiple, distinct data blocks.

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.

UpdateCRC ( byte b ) : void

Process one byte in the CRC.

UpdateCRC ( byte b, int n ) : void

Process a run of N identical bytes into the CRC.

This method serves as an optimization for updating the CRC when a run of identical bytes is found. Rather than passing in a buffer of length n, containing all identical bytes b, this method accepts the byte value and the length of the (virtual) buffer - the length of the run.

비공개 메소드들

메소드 설명
GenerateLookupTable ( ) : void
ReverseBits ( byte data ) : byte
ReverseBits ( uint data ) : uint
_InternalComputeCrc32 ( UInt32 W, byte B ) : Int32
gf2_matrix_square ( uint square, uint mat ) : void
gf2_matrix_times ( uint matrix, uint vec ) : uint

메소드 상세

CRC32() 공개 메소드

Create an instance of the CRC32 class using the default settings: no bit reversal, and a polynomial of 0xEDB88320.
public CRC32 ( ) : System
리턴 System

CRC32() 공개 메소드

Create an instance of the CRC32 class, specifying whether to reverse data bits or not.

In the CRC-32 used by BZip2, the bits are reversed. Therefore if you want a CRC32 with compatibility with BZip2, you should pass true here. In the CRC-32 used by GZIP and PKZIP, the bits are not reversed; Therefore if you want a CRC32 with compatibility with those, you should pass false.

public CRC32 ( bool reverseBits ) : System
reverseBits bool /// specify true if the instance should reverse data bits. ///
리턴 System

CRC32() 공개 메소드

Create an instance of the CRC32 class, specifying the polynomial and whether to reverse data bits or not.

In the CRC-32 used by BZip2, the bits are reversed. Therefore if you want a CRC32 with compatibility with BZip2, you should pass true here for the reverseBits parameter. In the CRC-32 used by GZIP and PKZIP, the bits are not reversed; Therefore if you want a CRC32 with compatibility with those, you should pass false for the reverseBits parameter.

public CRC32 ( int polynomial, bool reverseBits ) : System
polynomial int /// The polynomial to use for the CRC, expressed in the reversed (LSB) /// format: the highest ordered bit in the polynomial value is the /// coefficient of the 0th power; the second-highest order bit is the /// coefficient of the 1 power, and so on. Expressed this way, the /// polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320. ///
reverseBits bool /// specify true if the instance should reverse data bits. ///
리턴 System

Combine() 공개 메소드

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
리턴 void

ComputeCrc32() 공개 메소드

Get the CRC32 for the given (word,byte) combo. This is a computation defined by PKzip for PKZIP 2.0 (weak) encryption.
public ComputeCrc32 ( Int32 W, byte B ) : Int32
W System.Int32 The word to start with.
B byte The byte to combine it with.
리턴 System.Int32

GetCrc32() 공개 메소드

Returns the CRC32 for the specified stream.
public GetCrc32 ( System input ) : Int32
input System The stream over which to calculate the CRC32
리턴 System.Int32

GetCrc32AndCopy() 공개 메소드

Returns the CRC32 for the specified stream, and writes the input into the output stream.
public GetCrc32AndCopy ( System input, System output ) : Int32
input System The stream over which to calculate the CRC32
output System The stream into which to deflate the input
리턴 System.Int32

Reset() 공개 메소드

Reset the CRC-32 class - clear the CRC "remainder register."

Use this when employing a single instance of this class to compute multiple, distinct CRCs on multiple, distinct data blocks.

public Reset ( ) : void
리턴 void

SlurpBlock() 공개 메소드

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
리턴 void

UpdateCRC() 공개 메소드

Process one byte in the CRC.
public UpdateCRC ( byte b ) : void
b byte the byte to include into the CRC .
리턴 void

UpdateCRC() 공개 메소드

Process a run of N identical bytes into the CRC.

This method serves as an optimization for updating the CRC when a run of identical bytes is found. Rather than passing in a buffer of length n, containing all identical bytes b, this method accepts the byte value and the length of the (virtual) buffer - the length of the run.

public UpdateCRC ( byte b, int n ) : void
b byte the byte to include into the CRC.
n int the number of times that byte should be repeated.
리턴 void