title: Comparing hashed password from SQLite database to user input using BCrypt
body: <p>When my user logs in to the application I need their text version of the password to compare with the hashed value in the database. However i am really struggling. </p>
  
  <p>Can anyone help me?</p>
  
  <pre><code>public void onButtonClick(View v)
  
  {
      if (v.getId() == R.id.Blogin) {
  
          EditText a = (EditText) findViewById(R.id.TFusername);
          String str = a.getText().toString();
          EditText b = (EditText) findViewById(R.id.TFpassword);
          String pass = b.getText().toString();
  
  
          String login = helper.searchPass(str);
  
          **// if username is = to the password in the database
          if (pass.equals(login)
  
                  //method to check password hashes
                  // BCrypt.checkpw(*user input plain text*, *previous hash from db*
                  &amp;&amp; BCrypt.checkpw( //i dont know what to put here ) ) {**
  
              Intent i = new Intent(MainActivity.this, RegForensics.class);
              i.putExtra("Username", str);
              startActivity(i);
  
  
              Login l = new Login();
              l.setUserlog(str);
  
              helper.insertLogin(l);
  
  
          } else {
              Toast temp = Toast.makeText(MainActivity.this, "Username and password don't match!", Toast.LENGTH_SHORT);
              temp.show();
  
  
          }
  </code></pre>