title: mySQl login with c#
body: <p>I have a Homepage with a login with $hash = password_hash($accountpassword, PASSWORD_DEFAULT);.
  (<a href="http://php.net/manual/de/function.password-hash.php" rel="nofollow noreferrer">http://php.net/manual/de/function.password-hash.php</a>)</p>
  
  <p>The password is saved as hash begins with $2y$.</p>
  
  <p>Then i created the login in C#:</p>
  
  <pre><code> //crypting the PW that user enter
          string cryptedPassword = Crypter.Blowfish.Crypt(textBox_password.Text);
  
  
          string user = textBox_username.Text;
          string pass = cryptedPassword;
          if (user == "" || pass == "")
          {
              MessageBox.Show("Empty Fields Detected ! Please fill up all the fields");
              return;
          }
          bool r = validate_login(user, pass);
          if (r)
              MessageBox.Show("Correct Login Credentials");
          else
              MessageBox.Show("Incorrect Login Credentials"+cryptedPassword);
  </code></pre>
  
  <p>my validate method:</p>
  
  <pre><code>private bool validate_login(string user, string pass)
      {
          db_connection();
          MySqlCommand cmd = new MySqlCommand();
          cmd.CommandText = "Select * from users where username=@user and password=@pass";
          cmd.Parameters.AddWithValue("@user", user);
          cmd.Parameters.AddWithValue("@pass", pass);
          cmd.Connection = connect;
          MySqlDataReader login = cmd.ExecuteReader();
          if (login.Read())
          {
              connect.Close();
              return true;
          }
          else
          {
              connect.Close();
              return false;
          }
      }
  </code></pre>
  
  <p>at Crypter.Blowfish.Crypt(textBox_password.Text) is worng. I become a hash starts with $2a$</p>
  
  <p>can anyone help to fix this problem?</p>