C#最简单的字符串加密解密方法
投稿:junjie
这篇文章主要介绍了C#最简单的字符串加密解密方法,本文直接给出实例代码,需要的朋友可以参考下
public static string encode(string str)
{
string htext = "";
for (int i = 0; i < str.Length; i++)
{
htext = htext + (char)(str[i] + 10 - 1 * 2);
}
return htext;
}
public static string decode(string str)
{
string dtext = "";
for (int i = 0; i < str.Length; i++)
{
dtext = dtext + (char)(str[i] - 10 + 1 * 2);
}
return dtext;
}
