Exemplo n.º 1
0
        public void Crypto_64Char_100Pass()
        {
            List <string> Passwords = new List <string>();
            int           i         = 0;

            while (i < 100)
            {
                CryptoGenerator TestGenerator = new CryptoGenerator();
                Passwords.Add(TestGenerator.Next(64, true, true, true, true, false, true));
                Console.WriteLine(Passwords[i]);
                i++;
            }

            if (Passwords.GroupBy(n => n).Any(c => c.Count() > 1))
            {
                Assert.Fail("Duplicates found");
            }
        }
Exemplo n.º 2
0
        // Crypto
        private void bkgCryptoGen_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            // Block the UI Controls.
            Action BlockUI = () => grpCryptoSettings.Enabled = false;

            grpCryptoSettings.Invoke(BlockUI);

            // Save Settings
            Properties.Crypto.Default.Lower      = chkCryptoLower.Checked;
            Properties.Crypto.Default.Upper      = chkCryptoUpper.Checked;
            Properties.Crypto.Default.Number     = chkCryptoNumber.Checked;
            Properties.Crypto.Default.Special    = chkCryptoSpecial.Checked;
            Properties.Crypto.Default.Space      = chkCryptoSpace.Checked;
            Properties.Crypto.Default.IncludeAll = chkCryptoIncludeAll.Checked;
            Properties.Crypto.Default.Length     = (int)numCryptoLength.Value;
            Properties.Crypto.Default.Save();

            // Generate Passwords based on the settings defined.
            CryptoGenerator Generator = new CryptoGenerator();
            List <string>   Passwords = new List <string>();
            int             i         = 0;

            while (i < 10)
            {
                Passwords.Add(Generator.Next((int)numCryptoLength.Value, chkCryptoLower.Checked, chkCryptoUpper.Checked, chkCryptoNumber.Checked, chkCryptoSpecial.Checked, chkCryptoSpace.Checked, chkCryptoIncludeAll.Checked));
                i++;
            }
            // Update UI
            BeginInvoke((MethodInvoker) delegate
            {
                int j = 0;
                foreach (TextBox pwBox in tabCrypto.Controls.OfType <TextBox>())
                {
                    pwBox.Text = Passwords[j];
                    pwBox.Select(0, 0);
                    j++;
                }
            });

            // Unblock the UI Controls.
            Action UnblockUI = () => grpCryptoSettings.Enabled = true;

            grpCryptoSettings.Invoke(UnblockUI);
        }
Exemplo n.º 3
0
        public void Crypto_64Char_1Pass()
        {
            CryptoGenerator TestGenerator = new CryptoGenerator();

            Console.WriteLine(TestGenerator.Next(64, true, true, true, true, false, true));
        }