I am creating a word list of possible uppercase letters to prove how insecure 8 digit passwords are this code will write aaaaaaaa to aaaaaaab to aaaaaaac etc. until zzzzzzzz using this code:
class Program { static string path; static int file = 0; static void Main(string[] args) { new_file(); var alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789+-*_!$£^=<>§°ÖÄÜöäü.;:,?{}[]"; var q = alphabet.Select(x => x.ToString()); int size = 3; int counter = 0; for (int i = 0; i < size - 1; i++) { q = q.SelectMany(x => alphabet, (x, y) => x + y); } foreach (var item in q) { if (counter >= 20000000) { new_file(); counter = 0; } if (File.Exists(path)) { using (StreamWriter sw = File.AppendText(path)) { sw.WriteLine(item); Console.WriteLine(item); /*if (!(Regex.IsMatch(item, @"(.)\1"))) { sw.WriteLine(item); counter++; } else { Console.WriteLine(item); }*/ } } else { new_file(); } } } static void new_file() { path = @"C:\" + "list" + file + ".txt"; if (!File.Exists(path)) { using (StreamWriter sw = File.CreateText(path)) { } } file++; } } The Code is working fine but it takes Weeks to run it. Does anyone know a way to speed it up or do I have to wait? If anyone has a idea please tell me.