See Bcrypt
A 60-character string consisting of 29 characters of prefix and 31 characters of encrypted password.
The prefix looks like '$2b$12$IkhVgnCtC/HGtKLDA3QMEO'
where the parts are delimited by dollar signs
2b
means that it's encrypted using Bcrypt
12
is the work factor
The rest of the prefix is 22 characters of salt
The 31 characters at the end is the encrypted value.
Yes. That and duplicate passwords.
Because the salt is random, it means we can't precompute the encrypted values of common passwords like password
and secret
and 123456
.
Even if one person uses the same password on multiple sites, the salt means they will be encrypted differently
If two people use the same password on a single site, the salt means they will be encrypted differently
It just extracts the 22 characters of salt from the 60 character string and ignores the stuff it doesn't need. The rest of the hashing algorithm is the same.
Salt generation is just creating a random string. The hashing algorithm is iteration of a fast secure hashing algorithm. See algorithm at Wikipedia.
Sure. The basic idea is to optimistically insert and deal with an error if it occurs. So
versus The reason is concurrency. We *will* talk about this more at a later lecture, but I have found that teaching the second way and then trying to convince students the first way is better is a not successful.It matters because they'll both be logged in as the same UID, and so they'll be storing info into the same account.
That's a feature of the OS (operating system) and/or the browser. Pretty much outside our control.
Great question! I honestly don't know, but let's speculate: