core/model/modx/hashing/modpbkdf2.class.php
This file contains a modHash implementation of RSA PDKDF2.
- Package
- modx
- Subpackage
- hashing
\modPBKDF2
A PBKDF2 implementation of modHash.
- Parent(s)
- \modHash
Properties
\modHashing
$host= 'null'
A reference to the modHashing service hosting this modHash instance.
Inherited from: \modHash::$$hostnull
Details- Type
- \modHashing
- Inherited_from
- \modHash::$$host
Methods
__construct(
\modHashing $host, array | null $options
=
array()
)
:
\modHash
Name | Type | Description |
---|---|---|
$host | \modHashing | A reference to the modHashing instance |
$options | array | null | An optional array of configuration options |
Type | Description |
---|---|
\modHash | A new derivative instance of the modHash class |
getOption(
string $key, array | null $options
=
null, mixed $default
=
null
)
:
mixed
Searches for local options and then prefixes keys with hashing_ to look for MODX System Settings.
Name | Type | Description |
---|---|---|
$key | string | The option key to get a value for. |
$options | array | null | An optional array of options to look in first. |
$default | mixed | An optional default value to return if no value is set. |
Type | Description |
---|---|
mixed | The option value or the specified default if not found. |
hash(
string $string, array $options
=
array()
)
:
mixed
Generate a hash of a string using the RSA PBKDFA2 specification.
The following options are available: - salt (required): a valid, non-empty string to salt the hashes - iterations: the number of iterations per block, default is 1000 (< 1000 not recommended) - derived_key_length: the size of the derived key to generate, default is 32 - algorithm: the hash algorithm to use, default is sha256 - raw_output: if true, returns binary output, otherwise derived key is base64_encode()'d; default is false
Name | Type | Description |
---|---|---|
$string | string | A string to generate a secure hash from. |
$options | array | An array of options to be passed to the hash implementation. |
Type | Description |
---|---|
mixed | The hash result or false on failure. |