/utils/bcrypt
The bcrypt utility module exports methods to hash and compare password stored in the ACL.
The script has been taken from the built distribution of https://github.com/dcodeIO/bcrypt.js
- License
- bcrypt.js (c) 2013 Daniel Wirtz
Released under the Apache License, Version 2.0
- bcrypt.js (c) 2013 Daniel Wirtz
- Source
Methods
(inner) compareSync(s, hash) → {boolean}
Synchronously tests a string against a hash.
Parameters:
Name | Type | Description |
---|---|---|
s | string | String to compare |
hash | string | Hash to test against |
- Source
Throws:
If an argument is illegal
- Type
- Error
Returns:
true if matching, otherwise false
- Type:
- boolean
(inner) hashSync(s, saltopt) → {string}
Synchronously generates a hash for the given string.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
s | string | String to hash | |
salt | number | | <optional> | Salt length to generate or salt to use, default to 10 |
- Source
Returns:
Resulting hash
- Type:
- string