ImageTools.CRC32Calculator.SlurpBlock C# (CSharp) Method

SlurpBlock() public method

Update the value for the running CRC32 using the given block of bytes. This is useful when using the CRC32() class in a Stream.
public SlurpBlock ( byte block, int offset, int count ) : void
block byte block of bytes to slurp
offset int starting point in the block
count int how many bytes within the block to slurp
return void
        public void SlurpBlock(byte[] block, int offset, int count)
        {
            if (block == null)
            {
                throw new NotSupportedException("The data buffer must not be null.");
            }

            // UInt32 tmpRunningCRC32Result = this._RunningCrc32Result;
            for (int i = 0; i < count; i++)
            {
                int x = offset + i;
                _RunningCrc32Result = ((_RunningCrc32Result) >> 8) ^ crc32Table[(block[x]) ^ ((_RunningCrc32Result) & 0x000000FF)];
                //tmpRunningCRC32Result = ((tmpRunningCRC32Result) >> 8) ^ crc32Table[(block[offset + i]) ^ ((tmpRunningCRC32Result) & 0x000000FF)];
            }

            this._TotalBytesRead += count;
            //this._RunningCrc32Result = tmpRunningCRC32Result;
        }

Same methods

CRC32Calculator::SlurpBlock ( byte block ) : void

Usage Example

コード例 #1
0
        public static int CalculateCrc32(byte[] buffer)
        {
            CRC32Calculator cal = new CRC32Calculator();

            cal.SlurpBlock(buffer, 0, buffer.Length);
            return(cal.Crc32Result);
        }
All Usage Examples Of ImageTools.CRC32Calculator::SlurpBlock