您的位置:首页 > 编程语言 > C#

C#最简单的字符串加密解密方法

2015-05-08 09:48 1111 查看
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;
}

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息