-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEncryption.cs
42 lines (33 loc) · 931 Bytes
/
Encryption.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bus_Reservation_System
{
public static class Encryption
{
private static Queue<int> keyQueue = new Queue<int>();
private static void initialize()
{
keyQueue.Clear();
keyQueue.Enqueue(3);
keyQueue.Enqueue(1);
keyQueue.Enqueue(7);
keyQueue.Enqueue(5);
}
public static string EncryptPassword(string password)
{
initialize();
string encodedPass = "";
foreach (char c in password)
{
int shift = keyQueue.Dequeue();
keyQueue.Enqueue(shift);
char encodedChar = (char)(c + shift);
encodedPass += encodedChar;
}
return encodedPass;
}
}
}