bytesToint() 개인적인 정적인 메소드

private static bytesToint ( byte inBytes, int inOff ) : int
inBytes byte
inOff int
리턴 int
예제 #1
0
 private int[] generateWorkingKey(bool forEncryption, byte[] userKey)
 {
     this.forEncryption = forEncryption;
     if (userKey.Length != 32)
     {
         throw new ArgumentException("Key length invalid. Key needs to be 32 byte - 256 bit!!!");
     }
     int[] array = new int[8];
     for (int num = 0; num != 8; num++)
     {
         array[num] = Gost28147Engine.bytesToint(userKey, num * 4);
     }
     return(array);
 }
예제 #2
0
        private void Gost28147Func(int[] workingKey, byte[] inBytes, int inOff, byte[] outBytes, int outOff)
        {
            int num  = Gost28147Engine.bytesToint(inBytes, inOff);
            int num2 = Gost28147Engine.bytesToint(inBytes, inOff + 4);

            if (this.forEncryption)
            {
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        int num3 = num;
                        int num4 = this.Gost28147_mainStep(num, workingKey[j]);
                        num  = (num2 ^ num4);
                        num2 = num3;
                    }
                }
                for (int k = 7; k > 0; k--)
                {
                    int num3 = num;
                    num  = (num2 ^ this.Gost28147_mainStep(num, workingKey[k]));
                    num2 = num3;
                }
            }
            else
            {
                for (int l = 0; l < 8; l++)
                {
                    int num3 = num;
                    num  = (num2 ^ this.Gost28147_mainStep(num, workingKey[l]));
                    num2 = num3;
                }
                for (int m = 0; m < 3; m++)
                {
                    int num5 = 7;
                    while (num5 >= 0 && (m != 2 || num5 != 0))
                    {
                        int num3 = num;
                        num  = (num2 ^ this.Gost28147_mainStep(num, workingKey[num5]));
                        num2 = num3;
                        num5--;
                    }
                }
            }
            num2 ^= this.Gost28147_mainStep(num, workingKey[0]);
            Gost28147Engine.intTobytes(num, outBytes, outOff);
            Gost28147Engine.intTobytes(num2, outBytes, outOff + 4);
        }