Skip to main content

Class ChecksumCalculator

Provides CRC and checksum methods

Assembly: Meadow.Contracts.dll
View Source
public static class ChecksumCalculator

Methods

XOR(string)

Calculate a checksum for the string by XORing the bytes in the string.

View Source
public static byte XOR(string data)
Returns

System.Byte: XOR checksum for the string.

Parameters
TypeNameDescription
System.StringdataString to calculate the checksum for.

XOR(byte[])

Generate a checksum by XORing all of the data in the array.

View Source
public static byte XOR(byte[] data)
Returns

System.Byte: XOR Checksum of the array of bytes.

Parameters
TypeNameDescription
System.Byte[]dataData to calculate the checksum for.

PolynomialCRC(byte[], byte)

Calculate the 8-bit CRC using the specified polynomial.

View Source
public static byte PolynomialCRC(byte[] data, byte polynomial)
Returns

System.Byte

Parameters
TypeNameDescription
System.Byte[]dataData bytes to generate a CRC for.
System.BytepolynomialPolynomial byte to use in the CRC calculation.