private void buttonGenerate_Click(object sender, EventArgs e) { BuilderPasswordGeneratorParameters pgParameters = new BuilderPasswordGeneratorParameters(this); GeneratePassword generatePassword = new GeneratePassword(pgParameters); textBoxGeneratedPassword.Text = generatePassword.GetPassword(); }
static void Main(string[] args) { Console.WriteLine("================================================"); Console.WriteLine("To generate a password, insert 3 strings that will be used to generate"); Console.WriteLine("Insert string for first input"); var input1 = Console.ReadLine(); Console.WriteLine("Insert string for second input"); var input2 = Console.ReadLine(); Console.WriteLine("Insert string for third input"); var input3 = Console.ReadLine(); var response = GeneratePassword.generatePassword(input1, input2, input3); if (response != null) { Console.WriteLine("The Generated Password is: " + response); Console.ReadLine(); } else { Console.WriteLine("Failed to generate password"); Console.ReadLine(); } }
private void generate_Click(object sender, RoutedEventArgs e) { GeneratePassword generatePassword = new GeneratePassword(); generatedPassword.Content = generatePassword.Generator(); registration.IsEnabled = true; }
static void Main(string[] args) { Console.Title = "PasswordGenerator.exe"; // Characters & Digits available to be used for the generated password. string letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!£$%^&*()_<>?"; var password = GeneratePassword.Generate(letters); Console.WriteLine("Password Generated is: {}", password); }
static void Main(string[] args) { CheckPassword checkPassword = new CheckPassword(); string finalPassword = ""; bool done = false; bool lower = false; bool upper = false; bool special = false; bool digit = false; Console.Write("Lower Case Required(type yes or y otherwise no considered) : "); string input = Console.ReadLine().Trim(); if (input == "yes" || input == "y" || input == "Yes") { lower = true; input = ""; } Console.Write("Upper Case Required(type yes or y otherwise no considered) : "); input = Console.ReadLine().Trim(); if (input == "yes" || input == "y" || input == "Yes") { upper = true; input = ""; } Console.Write("Special Case Required(type yes or y otherwise no considered) : "); input = Console.ReadLine().Trim(); if (input == "yes" || input == "y" || input == "Yes") { special = true; input = ""; } Console.Write("Digits Case Required(type yes or y otherwise no considered) : "); input = Console.ReadLine().Trim(); if (input == "yes" || input == "y" || input == "Yes") { digit = true; input = ""; } Console.Write("Length Required (number) : "); int len = int.Parse(Console.ReadLine()); do { GeneratePassword generatePassword = new GeneratePassword(lower, upper, special, digit, len); finalPassword = generatePassword.GetPassword(); done = checkPassword.ValidPassword(finalPassword, lower, upper, special, digit); } while (!done); Console.WriteLine("Password is : {0} ", finalPassword); Console.ReadKey(); }