password_verify
lib callCapy
function password_verify(password : string, encoded : string) bool
Description
password_verify() tests a password against a stored encoding. It accepts the scrypt encodings of password_hash() and the bcrypt encodings of PHP password_hash(): $2y$, $2b$, and $2a$ with a cost from 4 through 31. The comparison takes constant time.
For bcrypt, the password ends at its first zero byte and only its first 72 bytes count, as in PHP.
It rejects malformed encodings and parameters above the Bearer limits. Set password length and sign-in rate limits in public handlers.
Parameters
password : the candidate password
encoded : the stored password encoding
Return Values
true when the password matches a valid encoding
Example
Capy
var encoded := password_hash("correct horse battery staple")
print(password_verify("correct horse battery staple", encoded), "\n")
Output
true