Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    length   = int.Parse(textBox1.Text);
            string specials = textBox2.Text;

            var    gen      = new RandomPassword(specials);
            string password = gen.Generate(length);

            textBox3.Text = password;
        }
Ejemplo n.º 2
0
        public void Generate()
        {
            var usernames = File.ReadAllLines(path);
            var fileFrom  = new FileInfo(path);
            var dir       = fileFrom.DirectoryName + @"\";

            var passGen = new RandomPassword("~$");
            var sb      = new StringBuilder(usernames.Length * 3);

            foreach (string username in usernames)
            {
                var password = passGen.Generate(16);
                sb.AppendLine(username);
                sb.AppendLine(password);
                sb.AppendLine();
            }

            File.WriteAllText(dir + "passwords.txt", sb.ToString());
        }