You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== check_bcrypt ==
Copy Code
The output would be:
Checks to see if this plaintext password does in fact hash to the hash specified. Unlike md5 or sha1, simply comparing hashes won't work. This function is aware of and compatible with secure_string.
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| check_bcrypt
|-
! scope="row" | Returns
| boolean
|-
! scope="row" | Usages
| plaintext, hash
|-
! scope="row" | Throws
|
|-
! scope="row" | Since
| 3.3.1
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| None
|}
=== Usages ===
check_bcrypt(plaintext, hash)=== Examples === ====Example 1==== Basic usage Given the following code:
assign(@plain, 'plaintext')
assign(@hash, bcrypt(@plain))
msg(if(check_bcrypt(@plain, @hash), 'They match!', 'They do not match!'))
msg(if(check_bcrypt('notTheRightPassword', @hash), 'They match!', 'They do not match!'))

1 {{function|assign}}(@plain, 'plaintext')
2 {{function|assign}}(@hash, {{function|bcrypt}}(@plain))
3 {{function|msg}}({{keyword|if}}({{function|check_bcrypt}}(@plain, @hash), 'They match!', 'They do not match!'))
4 {{function|msg}}({{keyword|if}}({{function|check_bcrypt}}('notTheRightPassword', @hash), 'They match!', 'They do not match!'))
They match! They do not match!
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)