3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::IO::Crc16 Class Reference

This class is used to calculate a 2-byte/16-bit CRC value for a memory buffer. More...

List of all members.

Public Member Functions

 Crc16 ()
 Creates a CRC calculator.
 Crc16 (ushort initial, ushort final, ushort polynomial)
 Creates a CRC calculator with the given CRC seed values.
ushort Calculate (byte[] buffer)
 Calculate a CRC for the given buffer.
ushort Calculate (byte[] buffer, uint bufferLength)
 Calculate a CRC for part of the given buffer (from the start).
ushort Calculate (byte[] buffer, uint startIndex, uint numberOfBytes)
 Calculate a CRC for part of the given buffer.

Properties

static Crc16 Crc [get]
 Access the default calculator.
static int CrcSize [get]
 The size of the calculated CRC in bytes.

Detailed Description

This class is used to calculate a 2-byte/16-bit CRC value for a memory buffer.

General usage is to use the Crc static property to access the default calculator (see below).

      ushort calcCrc(byte[] buffer)
      {
        return Crc16.Crc.Calculate(buffer);
      }

Constructor & Destructor Documentation

Tes::IO::Crc16::Crc16 ( ushort  initial,
ushort  final,
ushort  polynomial 
) [inline]

Creates a CRC calculator with the given CRC seed values.

Parameters:
initialThe initial CRC starting value.
finalThe final XOR value applied to the CRC.
polynomialThe polynomial use dto initialise the CRC table.

Member Function Documentation

ushort Tes::IO::Crc16::Calculate ( byte[]  buffer) [inline]

Calculate a CRC for the given buffer.

Parameters:
bufferThe buffer to operate on.
Returns:
The CRC value.
ushort Tes::IO::Crc16::Calculate ( byte[]  buffer,
uint  startIndex,
uint  numberOfBytes 
) [inline]

Calculate a CRC for part of the given buffer.

The startIndex must be in range of the buffer . The sum of the startIndex and the numberOfBytes must be less than or equal to buffer.Length.

Parameters:
bufferThe buffer to operate on.
startIndexCRC calculation starts at this byte into the buffer .
numberOfBytesThe number of bytes to calculate the CRC for.
Returns:
The CRC value.
ushort Tes::IO::Crc16::Calculate ( byte[]  buffer,
uint  bufferLength 
) [inline]

Calculate a CRC for part of the given buffer (from the start).

Parameters:
bufferThe buffer to operate on.
bufferLengthThe number of bytes to calculate the CRC for. Must be less than buffer.Length
Returns:
The CRC value.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events