title: Invalid salt version error in BCrypt.Net library - WinForms/C# application with MySQL DB
body: <p>I am currently making a password manager, therefore I make a log-in form with username and password fields. I want to <code>bcrypt</code> the password. I store the salt and the hashed password in the database (<a href="https://i.stack.imgur.com/NOYPy.png" rel="nofollow noreferrer">screenshot 1</a>). When the user enters their username and password what I do is:</p>
  
  <p>1.Retrieve the salt from the DB and use the <code>BCrypt.Net.BCrypt.HashPassword(password.Text, sal)</code> method to hash the submitted password  with the salt from the database </p>
  
  <p>2.Retrieve the original <strong>hashed</strong> password from the db table, and then use the method <code>BCrypt.Net.BCrypt.Verify(submhash, passdb)</code> to check if the 2 passwords hashes match.</p>
  
  <p>3.If they do match I open the main form of the program.</p>
  
  <p>However the VS Studio throws an exception : <strong>Invalid salt version</strong> ( <a href="https://i.stack.imgur.com/yUMrK.png" rel="nofollow noreferrer">screenshot 2</a>)</p>
  
  <p>I would like to ask where is the problem and how can I fix it?</p>
  
  <pre><code>            conn.Open();
              MySqlCommand cmd = new MySqlCommand();
              cmd.Connection = conn;
              cmd.Parameters.AddWithValue("@usr", username.Text);
             // cmd.Parameters.AddWithValue("@pas", password.Text);
              cmd.CommandText = "select password from users where username = @usr";
              passdb = (string)cmd.ExecuteScalar();
              MySqlCommand ss = new MySqlCommand();
              ss.Connection = conn;
              ss.Parameters.AddWithValue("@uun", username.Text);
              ss.CommandText = "select salt from users where username  = @uun";
              sal= (string)ss.ExecuteScalar();
              submhash = BCrypt.Net.BCrypt.HashPassword(password.Text, sal);
              MySqlCommand com = new MySqlCommand();
              com.Connection = conn;
              com.Parameters.AddWithValue("@unm", username.Text);
              if (BCrypt.Net.BCrypt.Verify(submhash, passdb))
              {
                  frmMain fm = new frmMain();
                  SesUser.username = username.Text;
                  SesUser.password = password.Text;
                  this.Hide();
                  fm.Show();
  
  
              }
              else
              {
                  MessageBox.Show("Username or password is incorrect!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
                  i++;
  
              }
  
          }
  </code></pre>