示例#1
0
        /// <summary>
        /// sha1加密
        /// </summary>
        /// <returns></returns>
        private static string CreateSha1(Hashtable parameters)
        {
            var sb    = new StringBuilder();
            var akeys = new ArrayList(parameters.Keys);

            akeys.Sort();

            foreach (var k in akeys)
            {
                if (parameters[k] != null)
                {
                    var v = (string)parameters[k];

                    if (sb.Length == 0)
                    {
                        sb.Append(k + "=" + v);
                    }
                    else
                    {
                        sb.Append("&" + k + "=" + v);
                    }
                }
            }
            return(SHA1UtilHelper.GetSha1(sb.ToString()).ToString().ToLower());
        }
示例#2
0
        /// <summary>
        /// 添加卡券Ext参数的签名加密方法
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private static string CreateNonekeySha1(Hashtable parameters)
        {
            var sb      = new StringBuilder();
            var aValues = new ArrayList(parameters.Values);

            aValues.Sort();

            foreach (var v in aValues)
            {
                sb.Append(v);
            }
            return(SHA1UtilHelper.GetSha1(sb.ToString()).ToString().ToLower());
        }
示例#3
0
        /// <summary>
        /// 生成cardSign的加密方法
        /// </summary>
        /// <returns></returns>
        private string CreateCardSha1()
        {
            StringBuilder sb    = new StringBuilder();
            ArrayList     akeys = new ArrayList(Parameters.Keys);

            akeys.Sort();

            foreach (string k in akeys)
            {
                string v = (string)Parameters[k];

                sb.Append(v);
            }
            return(SHA1UtilHelper.GetSha1(sb.ToString()).ToString().ToLower());
        }
示例#4
0
        /// <summary>
        /// 生成cardSign的加密方法
        /// </summary>
        /// <returns></returns>
        //TODO:DZY[150909]改为新版加密方法
        private string CreateCardSha1()
        {
            StringBuilder sb   = new StringBuilder();
            ArrayList     vals = new ArrayList(Parameters.Values);

            vals.Sort();

            foreach (string v in vals)
            {
                sb.Append(v);
            }
            string sbstr = sb.ToString();

            return(SHA1UtilHelper.GetSha1(sbstr).ToString().ToLower());
        }
示例#5
0
        /// <summary>
        /// sha1加密
        /// </summary>
        /// <returns></returns>
        private string CreateSha1()
        {
            StringBuilder sb    = new StringBuilder();
            ArrayList     akeys = new ArrayList(Parameters.Keys);

            akeys.Sort();

            foreach (string k in akeys)
            {
                string v = (string)Parameters[k];

                if (sb.Length == 0)
                {
                    sb.Append(k + "=" + v);
                }
                else
                {
                    sb.Append("&" + k + "=" + v);
                }
            }
            return(SHA1UtilHelper.GetSha1(sb.ToString()).ToString().ToLower());
        }