using System.Collections.Generic;
using System.Globalization;
private static readonly byte[] PswXORmask = new byte[33]
private static string DecodePassword(string value)
int num = value == null ? -1 : value.Length;
for (int index = 0; index < num / 2; ++index)
char ch1 = value[index * 2];
char ch2 = value[index * 2 + 1];
if (ch1 >= '0' && ch1 <= 'F' && ch2 >= '0' && ch2 <= 'F')
char ch3 = Convert.ToChar((int)byte.Parse(ch1.ToString() + ch2.ToString(), NumberStyles.HexNumber) ^ (int)PswXORmask[index % 33]);
private static string EncodePassword(string value)
if (string.IsNullOrEmpty(value))
for (int i = 0; i < len; i++)
int mask = (int)PswXORmask[i%33];
string hex = ((int)ch1 ^ mask).ToString("X2");
public static void Main()
Console.WriteLine(EncodePassword("Hello World"));