/// <summary>
        /// Encrypt a password
        /// </summary>
        /// <param name="account">Account information used to encrypt password</param>
        /// <returns>
        /// encrypted password.
        /// </returns>
        public string Encrypt(AccountPasswordInfo account)
        {
            if (account.PasswordSalt.IsEmpty())
            {
                account.PasswordSalt = Cryptography.GenerateSalt(32);
            }

            var saltAndPwd = String.Concat(account.Password, account.PasswordSalt);
            var bytes      = Encoding.UTF8.GetBytes(saltAndPwd);

            string computedHash;

            if (account.PasswordSalt.Length == 24)
            {
                var sha1 = SHA1.Create();
                computedHash = Convert.ToBase64String(sha1.ComputeHash(bytes));
            }
            else
            {
                var sha1256 = SHA256.Create();
                computedHash = Convert.ToBase64String(sha1256.ComputeHash(bytes));
            }

            return(computedHash);
        }
        /// <summary>
        /// Encrypt a password
        /// </summary>
        /// <param name="account">Account information used to encrypt password</param>
        /// <returns>
        /// encrypted password.
        /// </returns>
        public string Encrypt(AccountPasswordInfo account)
        {
            if (account.PasswordSalt.IsEmpty())
            {
                account.PasswordSalt = Cryptography.GenerateSalt();
            }

            return(EncryptString(account.Password, account.PasswordSalt));
        }
        /// <summary>
        /// Compare if the specified password matches the encrypted password
        /// </summary>
        /// <param name="account">Stored acount informagtion.</param>
        /// <param name="clearTextPassword">Password specified by user.</param>
        /// <returns>
        /// true if passwords match; otherwise null
        /// </returns>
        public bool Compare(AccountPasswordInfo account, string clearTextPassword)
        {
            var clearTextInfo = new AccountPasswordInfo(account.UniqueID, clearTextPassword)
            {
                PasswordSalt = account.PasswordSalt
            };
            var password = this.Encrypt(clearTextInfo);

            return(account.Password == password);
        }
        /// <summary>
        /// Compare if the specified password matches the encrypted password
        /// </summary>
        /// <param name="account">Stored acount informagtion.</param>
        /// <param name="clearTextPassword">Password specified by user.</param>
        /// <returns>
        /// true if passwords match; otherwise null
        /// </returns>
        public bool Compare(AccountPasswordInfo account, string clearTextPassword)
        {
            var clear = DecryptString(account.Password, account.PasswordSalt);

            return(clearTextPassword == clear);
        }