Fingerprint_Card

Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Checksums.Crc32 Class Referencesealed

Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. More...

Inheritance diagram for ICSharpCode.SharpZipLib.Checksums.Crc32:
[legend]
Collaboration diagram for ICSharpCode.SharpZipLib.Checksums.Crc32:
[legend]

## Public Member Functions
void | Reset ()
| Resets the CRC32 data checksum as if no update was ever called.
void | Update (int value)
| Updates the checksum with the int bval.
void | Update (byte[] buffer)
| Updates the checksum with the bytes taken from the array.
void | Update (byte[] buffer, int offset, int count)
| Adds the byte array to the data checksum.

## Static Package Functions
static uint | ComputeCrc32 (uint oldCrc, byte value)

## Properties
long | Value`[get, set]`
| Returns the CRC32 data checksum computed so far.

## Private Attributes
uint | crc
| The crc data checksum so far.

## Static Private Attributes
const uint | CrcSeed = 0xFFFFFFFF
static readonly uint[] | CrcTable

## Detailed Description

Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.

Polynomials over GF(2) are represented in binary, one bit per coefficient, with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b.

This calculation is done using the shift-register method of multiplying and taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x (which is shifting right by one and adding x^32 mod p if the bit shifted out is a one). We start with the highest power (least significant bit) of q and repeat for all eight bits of q.

The table is simply the CRC of all possible eight bit values. This is all the information needed to generate CRC's on data a byte at a time for all combinations of CRC register values and incoming bytes.

## Member Function Documentation

## ◆ ComputeCrc32()

uint ICSharpCode.SharpZipLib.Checksums.Crc32.ComputeCrc32 | ( | uint | oldCrc,
|  | byte | value )
| static package

Here is the caller graph for this function:

## ◆ Reset()

void ICSharpCode.SharpZipLib.Checksums.Crc32.Reset | ( |  | ) |

Resets the CRC32 data checksum as if no update was ever called.

Implements ICSharpCode.SharpZipLib.Checksums.IChecksum.

## ◆ Update() [1/3]

void ICSharpCode.SharpZipLib.Checksums.Crc32.Update | ( | byte[] | buffer | ) |

Updates the checksum with the bytes taken from the array.

Parameters

  buffer | buffer an array of bytes

Implements ICSharpCode.SharpZipLib.Checksums.IChecksum.

Here is the call graph for this function:

## ◆ Update() [2/3]

void ICSharpCode.SharpZipLib.Checksums.Crc32.Update | ( | byte[] | buffer,
|  | int | offset,
|  | int | count )

Adds the byte array to the data checksum.

Parameters

  buffer | The buffer which contains the data
  offset | The offset in the buffer where the data starts
  count | The number of data bytes to update the CRC with.

Implements ICSharpCode.SharpZipLib.Checksums.IChecksum.

## ◆ Update() [3/3]

void ICSharpCode.SharpZipLib.Checksums.Crc32.Update | ( | int | value | ) |

Updates the checksum with the int bval.

Parameters

  value | the byte is taken as the lower 8 bits of value

Implements ICSharpCode.SharpZipLib.Checksums.IChecksum.

Here is the caller graph for this function:

## Member Data Documentation

## ◆ crc

uint ICSharpCode.SharpZipLib.Checksums.Crc32.crc
| private

The crc data checksum so far.

## ◆ CrcSeed

const uint ICSharpCode.SharpZipLib.Checksums.Crc32.CrcSeed = 0xFFFFFFFF
| static private

## ◆ CrcTable

readonly uint [] ICSharpCode.SharpZipLib.Checksums.Crc32.CrcTable
| static private

## Property Documentation

## ◆ Value

long ICSharpCode.SharpZipLib.Checksums.Crc32.Value
| get set

Returns the CRC32 data checksum computed so far.

Implements ICSharpCode.SharpZipLib.Checksums.IChecksum.

The documentation for this class was generated from the following file:

- ICSharpCode.SharpZLib/Checksums/CRC32.cs