Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace serkoklausur
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Kennwortlänge: ");
- int lang = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Anzahl der Passwörter: ");
- int anzahl = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Komplexität");
- int input = Convert.ToInt32(Console.ReadLine());
- //klein u. großbuchstabe
- const string smallChars = "abcdefghijklmnopqrstuvwxyz";
- const string capitalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- //zusätzlich zahlen
- const string zahlen = "123456789";
- //zusätzlich sonderzeichen
- const string sonderzeichen = "_<>?\\/#&$";
- string possibleChars = null;
- if (input == 1)
- {
- possibleChars = smallChars + capitalChars;
- }
- else if (input == 2)
- {
- possibleChars = smallChars + capitalChars + zahlen;
- }
- else if (input == 3)
- {
- possibleChars = smallChars + capitalChars + zahlen + sonderzeichen;
- }
- Random rnd = new Random();
- for (int i = 0; i < anzahl; i++)
- {
- StringBuilder password = new StringBuilder();
- for (int a = 0; a < lang; a++)
- {
- password.Append(possibleChars[rnd.Next(possibleChars.Length)]);
- }
- Console.WriteLine(password);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement