-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (32 loc) · 1000 Bytes
/
Program.cs
File metadata and controls
46 lines (32 loc) · 1000 Bytes
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
using System.Security.Cryptography;
Console.Write("Password length (int): ");
int num = int.Parse(Console.ReadLine());
Console.Write("Include numbers (Y/N): ");
char include_numbers = char.Parse(Console.ReadLine());
Console.Write("Include Symbols (Y/N): ");
char include_symbols = char.Parse(Console.ReadLine());
Console.Write("Include Caps (Y/N): ");
char include_caps = char.Parse(Console.ReadLine());
string options = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
string symbols = "!@€£#$%^&*()-_=+[]{};':\"|\\,.<>/?`~";
string caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (include_numbers == 'y')
{
options += numbers;
}
if (include_symbols == 'y')
{
options += symbols;
}
if (include_caps == 'y')
{
options += caps;
}
char[] password = new char[num];
for (int i = 0; i < num; i++)
{
password[i] = options[RandomNumberGenerator.GetInt32(options.Length)];
}
Console.WriteLine(password);
Console.ReadLine();