title: How to authencticate the encrypt password with input password value?
body: <p>Here we call webapi service from mobile application to authenticate the userid and encrypted password in database.
  So to authenticate I encrypt the input password and compare with database password?</p>
  
  <p>Another question: Is it correct what I am doing?
  Or is it a better way to decrypt the database password value and check with input value. If second way is better, how can I do that?</p>
  
  <p>Below is my code:</p>
  
  <pre><code>  using (LoginServiceEntities context = new LoginServiceEntities())
          {
              var crypto = new SimpleCrypto.PBKDF2();
              var encrypass = crypto.Compute(Password);
              var user = (from u in context.user_master
                          where String.Compare(u.UserID, UserID, StringComparison.OrdinalIgnoreCase) == 0
                                &amp;&amp; u.Password== encrypass
                          select u).FirstOrDefault();
  
              return user != null;
      }
  </code></pre>