new HashingStrategy()
Hashing Strategy manager.
This class will load system provided hashing strategies and algorithms.
Methods
get(id) → {HashingAlgorithm}
Get an algorithm interface by its Id
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | the algorithm id |
Returns:
the algorithm
- Type
- HashingAlgorithm
hash(id, params, salt, password) → {string}
Hashes a password.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | the algorithm id |
params |
Object.<string, string> | the algorithm specific paramters |
salt |
string | the given salt |
password |
string | the given password |
Returns:
the hashed string
- Type
- string
put(id, algorithm) → {HashingStrategy}
Put or replace an algorithm into the list of system loaded algorithms.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | the algorithm id |
algorithm |
HashingAlgorithm | the implementation |
Returns:
self
- Type
- HashingStrategy
verify(hash, password) → {boolean}
Time constant password check. Regardless of the check, this algorithm executes the same number of
checks regardless of the correctly number of characters
Parameters:
| Name | Type | Description |
|---|---|---|
hash |
string | the hash to verify |
password |
string | the password to test against |
Returns:
boolean
- Type
- boolean