-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
88 lines (87 loc) · 3.35 KB
/
Program.cs
File metadata and controls
88 lines (87 loc) · 3.35 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
namespace encryptor
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Focus::Encryptor";
ConsoleColor white = ConsoleColor.White;
ConsoleColor red = ConsoleColor.Red;
ConsoleColor green = ConsoleColor.Green;
Console.WriteLine("FocusCrypt [Version 1.3.2.1]");
Console.WriteLine("https://www.github.com/focuscrypt/encryptor");
Console.ForegroundColor = green;
Console.WriteLine("Women's Rights Matters.");
Console.WriteLine();
Console.ForegroundColor = white;
start:
Console.Write("Create a Password:");
string pass = string.Empty;
ConsoleKey key;
do
{
ConsoleKeyInfo keyInfo = Console.ReadKey(intercept: true);
key = keyInfo.Key;
if (key == ConsoleKey.Backspace && pass.Length > 0)
{
Console.Write("\b \b");
pass = pass[0..^1];
}
else if (!char.IsControl(keyInfo.KeyChar))
{
Console.Write("*");
pass += keyInfo.KeyChar;
}
} while (key != ConsoleKey.Enter);
Console.WriteLine();
if (string.IsNullOrWhiteSpace(pass))
{
Console.ForegroundColor = red;
Console.WriteLine("Please set a password!");
Console.ForegroundColor = white;
Console.WriteLine();
goto start;
}
Console.ForegroundColor = green;
Console.WriteLine("You have created a password.");
Console.ForegroundColor = white;
Console.WriteLine();
second:
Console.Write("Enter a plain text:");
string ptext = Console.ReadLine();
if (string.IsNullOrWhiteSpace(ptext))
{
Console.ForegroundColor = red;
Console.WriteLine("Please enter any text.");
Console.ForegroundColor = white;
Console.WriteLine();
goto second;
}
Console.ForegroundColor = green;
Console.WriteLine("Ok.");
Console.ForegroundColor = white;
Console.WriteLine("The encryption process has started. Please wait...");
Console.WriteLine("The encryption process is complete. Result:");
Console.ForegroundColor = green;
Console.WriteLine();
Console.WriteLine("-----");
Console.ForegroundColor = white;
Console.WriteLine(Focus.Encrypt(ptext, pass));
Console.ForegroundColor = green;
Console.WriteLine("-----");
Console.WriteLine();
Console.ForegroundColor = white;
Console.WriteLine("Don't forget to copy the encrypted text!");
Console.Write("Do you want to do another encryption?(y/n)");
string c = Console.ReadLine();
if (c == "y")
{
Console.WriteLine();
goto start;
}
Console.Write("Press any key to exit.");
Console.ReadKey();
}
}
}