我试图比较PasswordHasher func生成的两个哈希,我不知道为什么密码和confirmPassword有相同的字符串,"如果"返回false。
string passwordHash = UserManager.PasswordHasher.HashPassword(password);
string confirmPasswordHash = UserManager.PasswordHasher.HashPassword(confirmPassword);
if (passwordHash != confirmPasswordHash)
{
ModelState.AddModelError("", "Not the same");
return View(user);
}
private AppUserManager UserManager
{
get { return HttpContext.GetOwinContext().GetUserManager<AppUserManager>(); }
}
那么如何正确比较哈希?