Beispiel #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());
        }
Beispiel #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());
        }