Beispiel #1
0
        public Crc32(Crc32Type type, Endianness endianness)
        {
            _polynomial = GetPolynomialByType(type);

            if (endianness == Endianness.Big)
            {
                _polynomial = FlipPolynomial(_polynomial);
                _endianness = endianness;
            }

            Reset();
        }
Beispiel #2
0
        public Crc32(Crc32Type type, Endianness endianness, UInt32 seed)
        {
            _polynomial = GetPolynomialByType(type);

            if (endianness == Endianness.Big)
            {
                _polynomial = FlipPolynomial(_polynomial);
                _endianness = endianness;
            }

            _seed = seed;

            Reset();
        }
Beispiel #3
0
        private UInt32 GetPolynomialByType(Crc32Type type)
        {
            switch (type)
            {
            case Crc32Type.Castagnoli:
                return(0x82F63B78);

            case Crc32Type.ISO_3309:
                return(0xEDB88320);

            case Crc32Type.Koopman:
                return(0xEB31D82E);

            case Crc32Type.Koopman_2:
                return(0x992C1A4C);

            case Crc32Type.Q:
                return(0xD5828281);

            default:
                throw new ArgumentOutOfRangeException("type", "The type parameter must be a valid Crc32Type.");
            }
        }
Beispiel #4
0
        public Crc32(Crc32Type type)
        {
            _polynomial = GetPolynomialByType(type);

            Reset();
        }