1 /// <summary>
2 /// Class to encrypt and decrypt the password
3 /// </summary>
4 public static class EncryptorDecryptor
5 {
6 public static int key = 3;
7
8 /// <summary>
9 /// Encrypts and decrypts a given string.
10 /// </summary>
11 /// <param name="textToEncrypt">The text to encrypt or decrypt.</param>
12 /// <returns></returns>
13 public static string EncryptDecrypt(string textToEncrypt)
14 {
15 StringBuilder inSb = new StringBuilder(textToEncrypt);
16 StringBuilder outSb = new StringBuilder(textToEncrypt.Length);
17 char c;
18 for (int i = 0; i < textToEncrypt.Length; i++)
19 {
20 c = inSb[i];
21 c = (char)(c ^ key);
22 outSb.Append(c);
23 }
24 return outSb.ToString();
25 }
26 }