GSF.IO.Checksums.CrcCCITT.Update C# (CSharp) Method

Update() public method

Updates the checksum with the int bval.
public Update ( byte value ) : void
value byte The value to use for the update.
return void
        public void Update(byte value)
        {
            crc = (ushort)((crc << 8) ^ CrcTable[((crc >> 8) ^ value) & 0xff]);
        }

Same methods

CrcCCITT::Update ( byte buffer, int offset, int count ) : void

Usage Example

Example #1
0
        /// <summary>Calculates the CRC-CCITT check-sum on specified portion of a buffer.</summary>
        /// <param name="data">Data buffer to perform check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform check-sum over.</param>
        /// <returns>Computed CRC-CCITT checksum over the specified portion of the buffer.</returns>
        /// <remarks>
        /// The CRC-CCITT is a table based 16-bit CRC popular for modem protocols defined for use by the
        /// Consultative Committee on International Telegraphy and Telephony (CCITT)
        /// </remarks>
        public static ushort CrcCCITTChecksum(this byte[] data, int startIndex, int length)
        {
            CrcCCITT checksum = new CrcCCITT();

            checksum.Update(data, startIndex, length);

            return(checksum.Value);
        }
All Usage Examples Of GSF.IO.Checksums.CrcCCITT::Update