• 自己写的加密方式


    const string sNil = "'(&.&!'%&$"'&)" ",&)$(%#$-$#$$" ";    //'''(&.&!''%&$"''&)" ",&)$(%#$-$#$$" ' ;
            const string sTemp = " !"#$%&'()*+,-./";                      // ' !"#$%&''()*+,-./';
            /// <summary>
            /// 
            /// </summary>
            /// <param name="xUserID"></param>
            /// <returns></returns>
            public static string EncodeUserID(string xUserID)
            {
                char[] sUserID = xUserID.ToCharArray();
                string sResult = sNil.Substring((sUserID.Length - 1) * 2, 30 - (sUserID.Length - 1) * 2);   //DS-〉&.&!'%&$"'&)" ",&)$(%#$-
                int k = 0, j = 0, l = 0;
                for (int i = sUserID.Length - 1; i >= 0; i--)
                {
                    l = Convert.ToInt32(sUserID[i]);
                    k = (l - 32) % 16;
                    j = ((l - 32) / 16) + 1;
    
                    sResult = sResult + Convert.ToChar(32 + j + 1) + sTemp[k];
                }
                return sResult;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="xUserID"></param>
            /// <returns></returns>
            public static string DecodeUserID(string xUserID)
            {
                string resultStr = string.Empty, sResult = string.Empty;
                for (var i = xUserID.Length - 1; i >= 0; )
                {
                    int x = sTemp.IndexOf(xUserID[i]);
                    int y = Convert.ToInt32(xUserID[i - 1]) - 33;
                    int l = ((y - 1) * 16) + 32 + x;
                    resultStr += Convert.ToChar(l);
                    sResult = sNil.Substring((resultStr.Length - 1) * 2, 30 - (resultStr.Length - 1) * 2);
                    string tmpStr = xUserID.Substring(0, i - 1);
                    if (sResult == tmpStr)
                    {
                        break;
                    }
                    i -= 2;
                }
                return resultStr;
            } 
    

      

  • 相关阅读:
    数组
    灰度转换
    类的定义和头文件
    读文件
    操纵元
    传递引用
    TensorFlow常用函数
    四、Item Pipeline
    三、Scrapy Shell
    二、Scrapy案例入门
  • 原文地址:https://www.cnblogs.com/kingkoo/p/3880394.html
Copyright © 2020-2023  润新知