首页 > 编程技术 > csharp

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

发布时间:2020-6-25 11:30

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;
    }

标签:[!--infotagslink--]

您可能感兴趣的文章: