Exemple #1
0
        public static string RandomString(int length)
        {
            StringBuilder sb = new StringBuilder();
            Random        r  = null;

            char[] randomChars = Shuffle <char>(chars.ToList()).ToArray();
            for (int j = 0; j < length; j++)
            {
                uint randomInt = CryptoRandomNumber.NextUInt();
                int  num1      = CryptoRandomNumber.Next();
                int  num2      = CryptoRandomNumber.Next();
                if (num1 < num2)
                {
                    r = new Random(CryptoRandomNumber.Next(num1, num2));
                }
                else
                {
                    r = new Random(CryptoRandomNumber.Next(num2, num1));
                }
                int min = r.Next(1, 10);
                int max = r.Next(77, 90);
                if (max > 87)
                {
                    max = 87;
                }
                char cc = randomChars[randomInt % r.Next(min, max)];
                sb.Append(cc);
            }
            return(sb.ToString());
        }
Exemple #2
0
        public static string RandomlyHide(string s)
        {
            List <char>   l      = new List <char>(s.ToArray());
            StringBuilder sb     = new StringBuilder();
            Random        random = new Random(CryptoRandomNumber.Next());
            int           r      = random.Next(16, 93);
            char          rc     = (char)(33 + r);

            sb.Append(rc.ToString());
            int mod = 10;

            foreach (char c in l)
            {
                int num = r % mod;
                sb.Append(c.ToString());
                sb.Append(RandomString(num));
                mod--;
                if (mod == 0)
                {
                    mod = 10;
                }
            }

            return(sb.ToString());
        }
Exemple #3
0
        private static int RandomNumber()
        {
            Random r   = new Random(CryptoRandomNumber.Next());
            int    min = r.Next(1, 64);
            int    max = r.Next(200, 254);

            return(r.Next(min, max));
        }
Exemple #4
0
        public static string ShiftText(string s)
        {
            Random r      = new Random(CryptoRandomNumber.Next());
            int    rndmin = r.Next(7, 44);
            int    rndmax = r.Next(66, 127);
            int    rnd    = r.Next(rndmin, rndmax);

            string hex = rnd.ToString("X2");

            return(hex + Obfuscation.Shift(s, rnd));
        }
Exemple #5
0
        public static string Bloat(string s)
        {
            List <char>   l      = new List <char>(s.ToArray());
            StringBuilder sb     = new StringBuilder();
            Random        random = new Random(CryptoRandomNumber.Next());
            int           r      = random.Next(4, 93);
            char          rc     = (char)(33 + r);

            sb.Append(rc.ToString());
            foreach (char c in l)
            {
                sb.Append(c.ToString());
                sb.Append(RandomString(r));
            }

            return(sb.ToString());
        }
Exemple #6
0
        private static string CreateKey()
        {
            StringBuilder sb     = new StringBuilder();
            Random        r      = new Random(CryptoRandomNumber.Next());
            int           rndmin = r.Next(7, 23);
            int           rndmax = r.Next(88, 112);
            int           rnd    = r.Next(rndmin, rndmax);

            for (int i = 0; i < rnd; i++)
            {
                int minmin = r.Next(32, 67);
                int minmax = r.Next(68, 127);
                int maxmin = r.Next(128, 255);
                int maxmax = r.Next(256, 312);
                int min    = r.Next(minmin, minmax);
                int max    = r.Next(maxmin, maxmax);
                int c      = r.Next(min, max);
                sb.Append((char)c);
            }

            return(sb.ToString());
        }
        private static string matrixProcess(string s)
        {
            string Row  = String.Empty;
            String Col  = String.Empty;
            int    row  = 0;
            int    col  = 0;
            int    seed = CryptoRandomNumber.Next();
            string hex  = seed.ToString("X8");

            StringBuilder      sb      = new StringBuilder();
            List <int>         numbers = new List <int>();
            List <List <int> > matrix  = new List <List <int> >();

            CreateRandomNumbers(seed, ref numbers);
            CreateMatrix(numbers, ref matrix);
            char[] sc = s.ToCharArray();

            foreach (char c in sc)
            {
                if ((int)c < upperNum)
                {
                    row = 0;
                    col = 0;
                    findIndex(matrix, ref row, ref col, c);

                    Row = convertRC(row);
                    Col = convertRC(col);
                    sb.Append(Row + Col);
                }
                else
                {
                    sb.Append(c.ToString());
                }
            }
            sb.Insert(0, hex);
            return(sb.ToString());
        }
Exemple #8
0
 public static List <T> Shuffle <T>(List <T> t)
 {
     return(t.OrderBy(x => new Random(CryptoRandomNumber.Next()).Next()).ToList());
 }