私は$ hash = password_hash($ accountpassword、PASSWORD_DEFAULT);でログインしたホームページを持っています。 (http://php.net/manual/de/function.password-hash.php)mySQl login with c#
パスワードは、$ 2y $で始まるハッシュとして保存されます。
//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);
私のvalidateメソッド::Crypter.Blowfish.Crypt(textBox_password.Text)で
private bool validate_login(string user, string pass)
{
db_connection();
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "Select * from users where [email protected] and [email protected]";
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;
}
}
がworngある
は、私はC#でのログインを作成しました。私は$ 2aで始まるハッシュになる$誰でもこの問題を解決するのに役立つことができますか?
hmm phpスクリプトは私の仕事ではありません。私はどのように2.パラメータを見つけることができますか? – Andreas
'Crypter.Blowfish.GenerateSalt(6)'のようなものを使用して、その値を保存するか、あなたが選んだ(安全性の低い)文字列を使用してください。私はあなたの塩を保存する必要なくチェックを実行できるようにする別の方法を含めるように私の答えを更新しました。 – Graeme