fm.liveswitch.Crc32 Class Reference

Calculates CRC32 checksums. More...

Public Member Functions

long compute (byte[] bytes)
 Computes the 32-bit CRC for an array of bytes. More...
 
long compute (byte[] bytes, int offset)
 Computes the 32-bit CRC for an array of bytes. More...
 
long compute (byte[] bytes, int offset, int length)
 Computes the 32-bit CRC for an array of bytes. More...
 
String computeHex (byte[] bytes)
 Computes the 32-bit CRC hex string for an array of bytes. More...
 
String computeHex (byte[] bytes, int offset)
 Computes the 32-bit CRC hex string for an array of bytes. More...
 
String computeHex (byte[] bytes, int offset, int length)
 Computes the 32-bit CRC hex string for an array of bytes. More...
 
 Crc32 ()
 Initializes a new instance of the fm.liveswitch.Crc32 class using the CRC32 polynomial. More...
 
 Crc32 (long polynomial)
 Initializes a new instance of the fm.liveswitch.Crc32 class using the specified polynomial. More...
 
 Crc32 (long polynomial, boolean reverseBits)
 Initializes a new instance of the fm.liveswitch.Crc32 class using the specified polynomial. More...
 
long getFinalXorValue ()
 Gets the value used to XOR the final result. More...
 
long getInitialValue ()
 Gets the initial value. More...
 
long getPolynomial ()
 Gets the polynomial. More...
 
boolean getReverseBits ()
 Gets a value indicating whether to reverse the bits. More...
 
void setFinalXorValue (long value)
 Sets the value used to XOR the final result. More...
 
void setInitialValue (long value)
 Sets the initial value. More...
 

Static Public Member Functions

static long getCrc32cPolynomial ()
 Gets the CRC32c polynomial. More...
 
static long getCrc32dPolynomial ()
 Gets the CRC32d polynomial. More...
 
static long getCrc32Polynomial ()
 Gets the CRC32 polynomial. More...
 

Detailed Description

Calculates CRC32 checksums.

Constructor & Destructor Documentation

◆ Crc32() [1/3]

fm.liveswitch.Crc32.Crc32 ( )

Initializes a new instance of the fm.liveswitch.Crc32 class using the CRC32 polynomial.

◆ Crc32() [2/3]

fm.liveswitch.Crc32.Crc32 ( long  polynomial)

Initializes a new instance of the fm.liveswitch.Crc32 class using the specified polynomial.

Parameters
polynomialThe polynomial.

◆ Crc32() [3/3]

fm.liveswitch.Crc32.Crc32 ( long  polynomial,
boolean  reverseBits 
)

Initializes a new instance of the fm.liveswitch.Crc32 class using the specified polynomial.

Parameters
polynomialThe polynomial.
reverseBitsWhether to reverse the bits.

Member Function Documentation

◆ compute() [1/3]

long fm.liveswitch.Crc32.compute ( byte[]  bytes)

Computes the 32-bit CRC for an array of bytes.

Parameters
bytesThe bytes.

◆ compute() [2/3]

long fm.liveswitch.Crc32.compute ( byte[]  bytes,
int  offset 
)

Computes the 32-bit CRC for an array of bytes.

Parameters
bytesThe bytes.
offsetThe offset.

◆ compute() [3/3]

long fm.liveswitch.Crc32.compute ( byte[]  bytes,
int  offset,
int  length 
)

Computes the 32-bit CRC for an array of bytes.

Parameters
bytesThe bytes.
offsetThe offset.
lengthThe length.

◆ computeHex() [1/3]

String fm.liveswitch.Crc32.computeHex ( byte[]  bytes)

Computes the 32-bit CRC hex string for an array of bytes.

Parameters
bytesThe bytes.

◆ computeHex() [2/3]

String fm.liveswitch.Crc32.computeHex ( byte[]  bytes,
int  offset 
)

Computes the 32-bit CRC hex string for an array of bytes.

Parameters
bytesThe bytes.
offsetThe offset.

◆ computeHex() [3/3]

String fm.liveswitch.Crc32.computeHex ( byte[]  bytes,
int  offset,
int  length 
)

Computes the 32-bit CRC hex string for an array of bytes.

Parameters
bytesThe bytes.
offsetThe offset.
lengthThe length.

◆ getCrc32cPolynomial()

static long fm.liveswitch.Crc32.getCrc32cPolynomial ( )
static

Gets the CRC32c polynomial.

◆ getCrc32dPolynomial()

static long fm.liveswitch.Crc32.getCrc32dPolynomial ( )
static

Gets the CRC32d polynomial.

◆ getCrc32Polynomial()

static long fm.liveswitch.Crc32.getCrc32Polynomial ( )
static

Gets the CRC32 polynomial.

◆ getFinalXorValue()

long fm.liveswitch.Crc32.getFinalXorValue ( )

Gets the value used to XOR the final result.

◆ getInitialValue()

long fm.liveswitch.Crc32.getInitialValue ( )

Gets the initial value.

◆ getPolynomial()

long fm.liveswitch.Crc32.getPolynomial ( )

Gets the polynomial.

◆ getReverseBits()

boolean fm.liveswitch.Crc32.getReverseBits ( )

Gets a value indicating whether to reverse the bits.

◆ setFinalXorValue()

void fm.liveswitch.Crc32.setFinalXorValue ( long  value)

Sets the value used to XOR the final result.

◆ setInitialValue()

void fm.liveswitch.Crc32.setInitialValue ( long  value)

Sets the initial value.