Exemple #1
0
        /// <summary>
        /// 解密加过密的字符串
        /// </summary>
        /// <param name="input"></param>
        /// <param name="throwException">解密失败是否抛异常</param>
        /// <returns></returns>
        public static string DecryptString(string input, bool throwException)
        {
            string res = "";

            try
            {
                res = input;// Base64.Decrypt(input);
                if (MD5Util.ValidateValue(res))
                {
                    return(MD5Util.RemoveMD5Profix(Base64Util.Decrypt(MD5Util.RemoveMD5Profix(res))));
                }
                else
                {
                    throw new Exception("字符串无法转换成功!");
                }
            }
            catch
            {
                if (throwException)
                {
                    throw;
                }
                else
                {
                    return("");
                }
            }
        }
Exemple #2
0
        public static string DecryptString(string input, bool throwException)
        {
            string str = "";

            try
            {
                str = input;
                if (!MD5Util.ValidateValue(str))
                {
                    throw new Exception("字符串无法转换成功!");
                }
                return(MD5Util.RemoveMD5Profix(Base64Util.Decrypt(MD5Util.RemoveMD5Profix(str))));
            }
            catch
            {
                if (throwException)
                {
                    throw;
                }
                return("");
            }
        }