示例#1
0
        public static string DecodePassword(string password, EPasswordFormat passwordFormat, string passwordSalt)
        {
            var retval = string.Empty;

            if (passwordFormat == EPasswordFormat.Clear)
            {
                retval = password;
            }
            else if (passwordFormat == EPasswordFormat.Hashed)
            {
                throw new Exception("can not decode hashed password");
            }
            else if (passwordFormat == EPasswordFormat.Encrypted)
            {
                var encryptor = new DesEncryptor
                {
                    InputString = password,
                    DecryptKey  = passwordSalt
                };
                encryptor.DesDecrypt();

                retval = encryptor.OutString;
            }
            return(retval);
        }
示例#2
0
        public static string Decrypt(string inputString)
        {
            if (string.IsNullOrEmpty(inputString)) return string.Empty;

            var encryptor = new DesEncryptor
            {
                InputString = inputString,
                DecryptKey = "TgQQk42O"
            };
            encryptor.DesDecrypt();
            return encryptor.OutString;
        }
示例#3
0
文件: FormBox.cs 项目: yangbg/SS.Form
        private static string Decrypt(string inputString)
        {
            if (string.IsNullOrEmpty(inputString))
            {
                return(string.Empty);
            }

            var encryptor = new DesEncryptor
            {
                InputString = inputString,
                DecryptKey  = "TgQQk42O"
            };

            encryptor.DesDecrypt();
            return(encryptor.OutString);
        }
示例#4
0
        public static string DecryptStringBySecretKey(string inputString, string secretKey)
        {
            if (string.IsNullOrEmpty(inputString))
            {
                return(string.Empty);
            }

            inputString = inputString.Replace("0add0", "+").Replace("0equals0", "=").Replace("0and0", "&").Replace("0question0", "?").Replace("0quote0", "'").Replace("0slash0", "/");

            var encryptor = new DesEncryptor
            {
                InputString = inputString,
                DecryptKey  = secretKey
            };

            encryptor.DesDecrypt();

            return(encryptor.OutString);
        }