0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
using System;
using System.Linq;
namespace TheBestGenerator
{
class Symbols
{
protected const string Letters = "abcdefghijklmnopqrstuvwxyz";
protected const string Numbers = "0123456789";
protected const string DefaultSpecialSymbols = @"!#$%&*@\";
protected static Random rand = new Random();
}
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("Введите длину пароля:");
int Len = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(Generator.Password(Len));
}
}
}
class Generator: Symbols
{
static char[] Array_()
{
return (Numbers+Letters+Letters.ToUpper()+DefaultSpecialSymbols).ToCharArray();
}
static char[] Password_Symbols()
{
return Array_().OrderBy(Symbol => rand.Next()).ToArray();
}
public static string Password(int Len )
{
char[] password = Password_Symbols();
Array.Resize(ref password, Len);
return (string.Join("", password));
}
}
}
Генератор паролей. Говнокод с наследованием. Почти ничего не понимаю в нем, но "прогу" с ним написал.
Запостил:
utsutsbabyj ,
22.07.2023 (Updated 22.07.2023 )
секуурно