示例#1
0
        public void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy)
        {
            this._crc32 = Crc32Helper.UpdateCrc32(this._crc32, buffer, offset, bytesToCopy);
            long num = this._inputStreamSizeModulo + (long)(uint)bytesToCopy;

            if (num >= 4294967296L)
            {
                num %= 4294967296L;
            }
            this._inputStreamSizeModulo = num;
        }
示例#2
0
文件: GZipUtils.cs 项目: supermax/TMS
        public void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy)
        {
            _crc32 = Crc32Helper.UpdateCrc32(_crc32, buffer, offset, bytesToCopy);

            var n = _inputStreamSizeModulo + (uint)bytesToCopy;

            if (n >= GZipConstants.FileLengthModulo)
            {
                n %= GZipConstants.FileLengthModulo;
            }
            _inputStreamSizeModulo = n;
        }
示例#3
0
 byte[] CalculateCrc32(byte[] data) => GetBytesForInteger((int)Crc32Helper.UpdateCrc32(0, data, 0, data.Length));
示例#4
0
        public void Test_CRC32_Computation(byte[] input, uint expected)
        {
            var actual = Crc32Helper.UpdateCrc32(0, input, 0, input.Length);

            Assert.Equal(expected, actual);
        }