public uint Crc()
        {
            var currentPosition = base.BaseStream.Position;

            try
            {
                base.BaseStream.Position = 0;
                return(Crc32Provider.Compute(ReadToEnd()));
            }
            finally
            {
                base.BaseStream.Position = currentPosition;
            }
        }
        public byte[] CrcHash()
        {
            var currentPosition = base.BaseStream.Position;

            try
            {
                base.BaseStream.Position = 0;
                return(Crc32Provider.ComputeHash(ReadToEnd()));
            }
            finally
            {
                base.BaseStream.Position = currentPosition;
            }
        }
Ejemplo n.º 3
0
        public byte[] CrcPayload()
        {
            var buffer = new byte[_stream.BaseStream.Length];

            //copy the payload over
            _stream.BaseStream.Position = 0;
            _stream.BaseStream.Read(buffer, 0, (int)_stream.BaseStream.Length);

            //calculate the crc
            var crc = Crc32Provider.ComputeHash(buffer, IntegerByteSize, buffer.Length);

            buffer[0] = crc[0];
            buffer[1] = crc[1];
            buffer[2] = crc[2];
            buffer[3] = crc[3];

            return(buffer);
        }