|
1易币
- protected string Sig(Dictionary<string, string> args)
- {
- Dictionary<string, string> codes = new Dictionary<string, string>()
- {
- {"a","3"},
- {"b","4"},
- {"c","5"},
- {"d","9"},
- {"e","8"},
- {"f","7"},
- {"g","1"},
- {"h","2"},
- {"i","6"},
- {"j","0"},
- {"k","a"},
- {"l","b"},
- {"m","c"},
- {"n","d"},
- {"o","e"},
- {"p","f"},
- {"q","g"},
- {"r","z"},
- {"s","y"},
- {"t","x"},
- {"u","w"},
- {"v","v"},
- {"w","u"},
- {"x","o"},
- {"y","p"},
- {"z","q"},
- {"0","s"},
- {"1","t"},
- {"2","r"},
- {"3","h"},
- {"4","i"},
- {"5","j"},
- {"6","k"},
- {"7","l"},
- {"8","m"},
- {"9","n"}
- };
- var list = new List<string>();
- foreach (var arg in args.Keys)
- {
- list.Add(arg);
- }
- list.Sort();
- var temp = new List<string>();
- for (var i = 0; i < list.Count; i++)
- {
- temp.Add(list[i] + "=" + args[list[i]]);
- }
- var md5Str = temp.Join("&").MD5();
- var screen = "19201080";
- var str = "";
- for (var i = 0; i < screen.Length; i++)
- {
- str += codes[screen[i].ToString()];
- }
- var result = "";
- var index = 0;
- if (md5Str.Length >= str.Length)
- {
- for (index = 0; index < str.Length; index++)
- {
- result += md5Str[index].ToString() + str[index].ToString();
- }
- result += md5Str.Substring(index);
- }
- else
- {
- for (index = 0; index < md5Str.Length; index++)
- {
- result += md5Str[index].ToString() + str[index].ToString();
- }
- result += md5Str.Substring(index);
- }
- var aes = new Xhelper.Crypto.AES("moonshadmoonshad");
- var text = aes.Encrypt(result);
- text = Convert.ToBase64String(Encoding.UTF8.GetBytes(text));
- return text;
- }
复制代码
|
|