示例#1
0
        public static long Get(byte[] data, int start, int length)
        {
            Adler32 adler32 = new Adler32();

            adler32.Add(data, start, length);
            return(adler32.Get());
        }
示例#2
0
        public static long Get(byte[] data)
        {
            Adler32 adler32 = new Adler32();

            adler32.Add(data);
            return(adler32.Get());
        }
示例#3
0
        public int SetDictionary(CompressionStream stream, byte[] dictionary, int dictLength)
        {
            int start = 0;
            int n     = dictLength;

            if (stream == null || this.state != InflaterState.DictionaryZero)
            {
                return(-2);
            }
            if (Adler32.Get(dictionary, 0, dictLength) != stream.Checksum.Get())
            {
                return(-3);
            }
            stream.Checksum = new Adler32();
            if (n >= 1 << this.wbits)
            {
                n     = (1 << this.wbits) - 1;
                start = dictLength - n;
            }
            this.blocks.SetDictionary(dictionary, start, n);
            this.state = InflaterState.Blocks;
            return(0);
        }