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


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3