PasswordVerify: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Shared function}} {{Note box|Using '''passwordHash''' is the recommended way of storing passwords.}} {{New feature/item|3.0154|1.5.4|11277| This function verifies...") |
No edit summary |
||
(7 intermediate revisions by 3 users not shown) | |||
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"> | ||
bool passwordVerify ( string password, string hash ) | bool passwordVerify ( string password, string hash[, function callback] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''password:''' The password to check. | *'''password:''' The password to check. | ||
*'''hash:''' A supported hash (see [[passwordHash]]) | *'''hash:''' A supported hash (see [[passwordHash]]). <span style="color:red">Note that only the prefix ''$2y$'' is supported for type bcrypt (older prefixes can cause security issues).</span> | ||
===Optional Arguments=== | |||
{{New feature/item|3.0154|1.5.4|11281| | |||
*'''callback:''' providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below. | |||
}} | |||
===Returns=== | ===Returns=== | ||
Returns true if the password matches the hash. Returns false if the password does not match, or if an unknown hash was passed. | 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== | ==Example== | ||
See [[passwordHash]] example. | |||
==See Also== | ==See Also== | ||
{{Utility functions}} | {{Utility functions}} |
Revision as of 15:19, 14 May 2017
This template is no longer in use as it results in poor readability. 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
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
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
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace
- debugSleep
- decodeString
- deref
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getProcessMemoryStats
- getRealTime
- getServerConfigSetting
- getTickCount
- getTimerDetails
- getTimers
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- ref
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setServerConfigSetting
- setTimer
- sha256
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub