Esempio n. 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()).ToLower());
        }
Esempio n. 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());
        }
Esempio n. 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());
        }
Esempio n. 4
0
        /// <summary>
        /// 生成cardSign的加密方法
        /// </summary>
        /// <returns></returns>
        private static string CreateCardSha1(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];
                    sb.Append(v);
                }
            }
            return(SHA1UtilHelper.GetSha1(sb.ToString()).ToString().ToLower());
        }
Esempio n. 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());
        }