Пример #1
0
        private void eksKey(byte[] data, byte[] key)
        {
            uint[] word   = new uint[2];
            int    length = (int)this.p.Length;
            int    num    = (int)this.s.Length;
            int    num1   = 0;

            for (int i = 0; i < length; i++)
            {
                this.p[i] ^= BCrypt.streamToWord(key, ref num1);
            }
            int num2 = 0;

            for (int j = 0; j < length; j += 2)
            {
                word[0] ^= BCrypt.streamToWord(data, ref num2);
                word[1] ^= BCrypt.streamToWord(data, ref num2);
                this.encipher(word, 0);
                this.p[j]     = word[0];
                this.p[j + 1] = word[1];
            }
            for (int k = 0; k < num; k += 2)
            {
                word[0] ^= BCrypt.streamToWord(data, ref num2);
                word[1] ^= BCrypt.streamToWord(data, ref num2);
                this.encipher(word, 0);
                this.s[k]     = word[0];
                this.s[k + 1] = word[1];
            }
        }
Пример #2
0
        private void key(byte[] key)
        {
            uint[] numArray = new uint[2];
            int    length   = (int)this.p.Length;
            int    num      = (int)this.s.Length;
            int    num1     = 0;

            for (int i = 0; i < length; i++)
            {
                this.p[i] ^= BCrypt.streamToWord(key, ref num1);
            }
            for (int j = 0; j < length; j += 2)
            {
                this.encipher(numArray, 0);
                this.p[j]     = numArray[0];
                this.p[j + 1] = numArray[1];
            }
            for (int k = 0; k < num; k += 2)
            {
                this.encipher(numArray, 0);
                this.s[k]     = numArray[0];
                this.s[k + 1] = numArray[1];
            }
        }