/// <param name="input">Input buffer containing data to be checksummed.</param>
/// <returns>CRC-32 of the buffer.</returns>
publicstaticuintCompute(byte[]input)
{
returnAppend(0,input);
}
/// <summary>
/// Computes CRC-32 from input buffer and writes it after end of data (buffer should have 4 bytes reserved space for it). Can be used in conjunction with <see cref="IsValidWithCrcAtEnd(byte[],int,int)"/>
/// </summary>
/// <param name="input">Input buffer with data to be checksummed.</param>
/// <param name="offset">Offset of the input data within the buffer.</param>
/// <param name="length">Length of the input data in the buffer.</param>
/// <returns>CRC-32 of the data in the buffer.</returns>
thrownewArgumentOutOfRangeException("length","Length of data should be less than array length - 4 bytes of CRC data");
varcrc=Append(0,input,offset,length);
varr=offset+length;
input[r]=(byte)crc;
input[r+1]=(byte)(crc>>8);
input[r+2]=(byte)(crc>>16);
input[r+3]=(byte)(crc>>24);
returncrc;
}
/// <summary>
/// Computes CRC-32 from input buffer - 4 bytes and writes it as last 4 bytes of buffer. Can be used in conjunction with <see cref="IsValidWithCrcAtEnd(byte[])"/>
/// </summary>
/// <param name="input">Input buffer with data to be checksummed.</param>
/// <returns>CRC-32 of the data in the buffer.</returns>
publicstaticuintComputeAndWriteToEnd(byte[]input)
{
if(input.Length<4)
thrownewArgumentOutOfRangeException("input","Input array should be 4 bytes at least");
/// Validates correctness of CRC-32 data in source buffer with assumption that CRC-32 data located at end of buffer in reverse bytes order. Can be used in conjunction with <see cref="ComputeAndWriteToEnd(byte[],int,int)"/>
/// </summary>
/// <param name="input">Input buffer with data to be checksummed.</param>
/// <param name="offset">Offset of the input data within the buffer.</param>
/// <param name="lengthWithCrc">Length of the input data in the buffer with CRC-32 bytes.</param>
/// Validates correctness of CRC-32 data in source buffer with assumption that CRC-32 data located at end of buffer in reverse bytes order. Can be used in conjunction with <see cref="ComputeAndWriteToEnd(byte[],int,int)"/>
/// </summary>
/// <param name="input">Input buffer with data to be checksummed.</param>
/// <returns>Is checksum valid.</returns>
publicstaticboolIsValidWithCrcAtEnd(byte[]input)
{
if(input.Length<4)
thrownewArgumentOutOfRangeException("input","Input array should be 4 bytes at least");