Hi! When I first heard about BruteForce, I imagined going over all the options from "a" to "z". I have created such code long ago, but it would be worth thinking about exceptions:
With this code you can get absolutely all combinations of passwords, but it will take an incredible amount of time. I'm not saying that this is the best way (rather the opposite), but this is the real Brute Force.
Spoiler (Click to View)
Author: Mathian Developer
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace Cycle
{
class Program
{
static void Main(string[] args)
{
string Chars = "Alphabet";
for (int i = 0; i <= 3; i++)
{
foreach (var Password in GetCombinations(Chars.ToArray(), i))
Console.WriteLine(Password);
}
Console.ReadLine();
}
private static IEnumerable<string> GetCombinations(char[] Chars, int MaximumLength)
{
if (MaximumLength < 1) yield break;
foreach (var a in Chars)
{
yield return a.ToString();
foreach (var b in GetCombinations(Chars, MaximumLength - 1)) yield return a + b;
}
}
}
}Spoiler (Click to View)
Author: Mathian Developer


