private string EncodePassword(string pass, string salt, MembershipPasswordFormat format) { if (format == MembershipPasswordFormat.Clear) { return(pass); } if (format == MembershipPasswordFormat.Hashed) { if (!Enum.IsDefined(typeof(SimpleHashAlgorithm), this.EncryptionAlgorithm)) { throw new ProviderException("Encryption algorithm not valid. Possible values are " + DebugUtility.GetDebugString(typeof(SimpleHashAlgorithm)) + " when using hashed encryption."); } return(EncryptionManager.ComputeHash(pass, (SimpleHashAlgorithm)Enum.Parse(typeof(SimpleHashAlgorithm), this.EncryptionAlgorithm), Encoding.Unicode.GetBytes(salt))); } else { if (this.EncryptionAlgorithm.ToUpper() == "DPAPI") { return(EncryptionManager.EncryptDPAPI(pass)); } if (!Enum.IsDefined(typeof(RijndaelSimpleHashAlgorithm), this.EncryptionAlgorithm)) { throw new ProviderException("Membership.HashAlgorithmType not found. Possible values are " + DebugUtility.GetDebugString(typeof(RijndaelSimpleHashAlgorithm)) + " and DPAPI"); } return(EncryptionManager.AES_Simple_Encrypt(pass, this.PasswordPassphrase, salt, this.PasswordInitVector, (RijndaelSimpleHashAlgorithm)Enum.Parse(typeof(RijndaelSimpleHashAlgorithm), this.EncryptionAlgorithm), RijndaelSimpleKeySize.Medium, 3)); } }