该算法对某个字符串运行奇数次为加密,偶数次为解密;加密解密为同一个函数。
private string Encryption(string strPwd)
{
string strKey = "ftjkibhgwr";
byte[] key ; //key设为10字符字符串
byte[] Pwd;
while ( strKey.Length<strPwd.Length )
{
strKey += strKey;
}
key =Encoding .Default .GetBytes (strKey );
Pwd = Encoding.Default.GetBytes(strPwd);
for (int i = 0; i < strPwd .Length ; i++)
{
Pwd [i] = (byte)(Pwd[i] ^ key[i]);
}
return Encoding.Default.GetString(Pwd );
}
private string Encryption(string strPwd)