4

I am using ASP.NET MVC 5 along with microsoft identity.

I have a table called AspNetUsers.

It has a field called "PasswordHash".

i created 2 users with the same password, yet the password hash is different.

Why is that i dont understand how it functions? Does it use the machine key?

What would happen if i deploy my server in the cloud, with the same database.

Would identity password comparison continue to function there also?

TotalWar
  • 335
  • 1
  • 6
  • 16

1 Answers1

5

Identity puts password hash and salt in the same field in the database. Password hash is always 32 bytes long and salt is always 16 bytes long. So when it comes to password-validation, Identity always knows what is salt and what is the actual hash. You can verify this by looking on the source code.

And because the salt is always different from one execution to another, password with salt attached will always produce you different hash results.

trailmax
  • 34,305
  • 22
  • 140
  • 234