PasswordVerify: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (link to passwordHash for example)
No edit summary
Line 5: Line 5:
This function verifies whether a password matches a password hash.
This function verifies whether a password matches a password hash.
}}
}}
{{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}}
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 19:34, 24 April 2017

This template is no longer in use as it results in poor readability. 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

Syntax

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

Required Arguments

  • password: The password to check.
  • hash: A supported hash (see passwordHash)

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

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.

Example

See passwordHash example.

See Also