From Multi Theft Auto: Wiki
Revision as of 15:19, 14 May 2017 by Jusonex (talk | contribs)

Jump to: navigation, search

Note: Using passwordHash is the recommended way of storing passwords.

This function verifies whether a password matches a password hash.

[[|link=]] Warning: It is strongly recommended to use the async version of the function (i.e. provide a callback function). Otherwise, you will experience short freezes due to the slow nature of the bcrypt algorithm


bool passwordVerify ( string password, string hash[, function callback] )  

Required Arguments

  • password: The password to check.
  • hash: A supported hash (see passwordHash). Note that only the prefix $2y$ is supported for type bcrypt (older prefixes can cause security issues).

Optional Arguments

  • callback: providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.


Returns true if the password matches the hash. Returns false if the password does not match, or if an unknown hash was passed. If a callback was provided, the aforementioned values are arguments to the callback, and this function will always return true.


See passwordHash example.

See Also