cryptLib
cryptLib
cryptLib
I encode and verify password hashes. I support multiple hashing algorithms to make upgrades easier.
Metadata
Instantiating |
- encodePassword
- findHash
- getDefaultHashName
- getHashComponent
- getOrderedHashArray
- hashedPasswordIsStale
- init
- isHashAlgorithmSupported
- passwordMatchesHash
encodePassword()
Convert a clear password to its encoded value
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
password | string | Yes | Input password | ||
hashName | string | No | [runtime expression] | Alias of hash algorithm to encode password |
findHash()
Returns a PasswordHash component that can verify this hashed password
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
hashedPassword | string | Yes | Hashed password string |
getDefaultHashName()
Return the alias of the default algorithm used to encoded passwords
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
None |
getHashComponent()
Return a hash algorithm component
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
hashName | string | No | [runtime expression] | Alias of hash algorithm |
getOrderedHashArray()
Return an array of supported PasswordHash components in order of priority
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
None |
hashedPasswordIsStale()
Is the hashed password stale (i.e. needs to be regenerated)?
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
hashedPassword | string | Yes | Hashed password | ||
password | string | Yes | Source password | ||
hashName | string | No | [runtime expression] | Alias of hash algorithm that hashed password should be using |
init()
Constructor
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
None |
isHashAlgorithmSupported()
Is this hash algorithm supported?
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
hashName | string | Yes | Alias of hash algorithm |
passwordMatchesHash()
Check if a clear password matches an encoded hash
Arguments
Name | Type | Required | Default | Options | Description |
---|---|---|---|---|---|
password | string | Yes | Input password | ||
hashedPassword | string | Yes | Hashed password |