Esempio n. 1
0
        public string MakeSign_SHA256()
        {
            //转url格式
            string str = ToUrl();

            //在string后加入API KEY
            str += "&key=" + WxPayConfig.getKEY(city);//不加
            //所有字符转为大写
            return(SHA256(str));
        }
Esempio n. 2
0
        /**
         * @生成签名,详见签名生成算法
         * @return 签名, sign字段不参加签名
         */
        public string MakeSign()
        {
            //转url格式
            string str = ToUrl();

            //在string后加入API KEY
            str += "&key=" + WxPayConfig.getKEY(city);//不加
            if (this.IsSet("contract_display_account") && this.GetValue("contract_display_account").ToString() == "135****1726")
            {
                Log.Write("luo sign sourcestr:", str);
            }
            //MD5加密
            var md5 = MD5.Create();
            var bs  = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
            var sb  = new StringBuilder();

            foreach (byte b in bs)
            {
                sb.Append(b.ToString("x2"));
            }
            //所有字符转为大写
            return(sb.ToString().ToUpper());
        }