ClearAll() private static method

private static ClearAll ( ) : void
return void
Ejemplo n.º 1
0
        private static byte[] MFcrypt(byte[] P, byte[] S, int N, int r, int p, int dkLen)
        {
            int num = r * 128;

            byte[] array  = SCrypt.SingleIterationPBKDF2(P, S, p * num);
            uint[] array2 = null;
            byte[] result;
            try
            {
                int num2 = array.Length >> 2;
                array2 = new uint[num2];
                Pack.LE_To_UInt32(array, 0, array2);
                int num3 = num >> 2;
                for (int i = 0; i < num2; i += num3)
                {
                    SCrypt.SMix(array2, i, N, r);
                }
                Pack.UInt32_To_LE(array2, array, 0);
                result = SCrypt.SingleIterationPBKDF2(P, array, dkLen);
            }
            finally
            {
                SCrypt.ClearAll(new Array[]
                {
                    array,
                    array2
                });
            }
            return(result);
        }
Ejemplo n.º 2
0
        private static void SMix(uint[] B, int BOff, int N, int r)
        {
            int num = r * 32;

            uint[]   array  = new uint[16];
            uint[]   array2 = new uint[16];
            uint[]   array3 = new uint[num];
            uint[]   array4 = new uint[num];
            uint[][] array5 = new uint[N][];
            try
            {
                Array.Copy(B, BOff, array4, 0, num);
                for (int i = 0; i < N; i++)
                {
                    array5[i] = (uint[])array4.Clone();
                    SCrypt.BlockMix(array4, array, array2, array3, r);
                }
                uint num2 = (uint)(N - 1);
                for (int j = 0; j < N; j++)
                {
                    uint num3 = array4[num - 16] & num2;
                    SCrypt.Xor(array4, array5[(int)((UIntPtr)num3)], 0, array4);
                    SCrypt.BlockMix(array4, array, array2, array3, r);
                }
                Array.Copy(array4, 0, B, BOff, num);
            }
            finally
            {
                SCrypt.ClearAll(array5);
                SCrypt.ClearAll(new Array[]
                {
                    array4,
                    array,
                    array2,
                    array3
                });
            }
        }