model/modx/hashing/modhashing.class.php
- package
- modx
- subpackage
- hashing
- Classes
- modHashing
- modHash
Description
This file contains the modHashing service class definition and the modHash abstract implementation class.
\modHash
- abstract
- Implement a derivative of this class to define an actual hash algorithm implementation.
- package
- modx
- subpackage
- hashing
- Properties
- $host
- $options
- Methods
- __construct
- getOption
- hash
Description
Defines the interface for a modHash implementation.
Properties
$host
\modHashing $host = 'null'
A reference to the modHashing service hosting this modHash instance.
Details
-
\modHashing
- visibility
- public
- default
- null
- final
- false
- static
- false
$options
array $options = 'array'
An array of options for the modHash implementation.
Details
- array
- visibility
- public
- default
- array
- final
- false
- static
- false
Methods
__construct
__construct(
\modHashing $host, array $options
=
array
)
:
\modHash
Constructs a new instance of the modHash class.
Arguments
- $host
- \modHashing
A reference to the modHashing instance - $options
- array
An array of configuration options
Output
- \modHash
- A new instance of a derivative of the modHash class
Details
- visibility
- public
- final
- false
- static
- false
getOption
getOption(
string $key, array|null $options
=
null, mixed $default
=
null
)
:
mixed
Get an option for this modHash implementation
Searches for local options and then prefixes keys with hashing_ to look for MODX System Settings.
Arguments
- $key
- string
The option key to get a value for. - $options
- arraynull
An optional array of options to look in first. - $default
- mixed
An optional default value to return if no value is set.
Output
- mixed
- The option value or the specified default if not found.
Details
- visibility
- public
- final
- false
- static
- false
hash
hash(
string $string, array $options
=
array
)
:
mixed
Generate a hash of the given string using the provided options.
Arguments
- $string
- string
A string to generate a secure hash from. - $options
- array
An array of options to be passed to the hash implementation.
Output
- mixed
- The hash result or false on failure.
Details
- visibility
- public
- final
- false
- static
- false
- abstract
\modHashing
- package
- modx
- subpackage
- hashing
- Properties
- $_hashes
- $modx
- $options
- Methods
- __construct
- getHash
- getOption
Description
The modX hashing service class.
Properties
$_hashes
array $_hashes = 'array'
An array of loaded modHash implementations.
Details
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
$modx
\xPDO $modx = 'null'
A reference to an xPDO instance communicating with this service instance.
Though this is typically a modX instance, an xPDO instance must work for new installs.
Details
-
\xPDO
- visibility
- public
- default
- null
- final
- false
- static
- false
$options
array $options = 'array'
An array of options for the hashing service.
Details
- array
- visibility
- public
- default
- array
- final
- false
- static
- false
Methods
__construct
__construct(
\xPDO $modx, array $options
=
array
)
:
Constructs a new instance of the modHashing service class.
Arguments
- $modx
- \xPDO
&$modx A reference to an modX (or xPDO) instance. - $options
- array
An array of options for the hashing service.
Details
- visibility
- public
- final
- false
- static
- false
getHash
getHash(
string $key, string $class, array $options
=
array
)
:
array|null
Get a hash implementation instance.
The implementation is made available as a member variable of the modHashing service.
Arguments
- $key
- string
A key string identifying the instance; must be a valid PHP variable name. - $class
- string
A valid fully-qualified modHash derivative class name - $options
- array
Output
- array|null
Details
- visibility
- public
- final
- false
- static
- false
getOption
getOption(
string $key, array|null $options
=
null, mixed $default
=
null
)
:
mixed
Get an option for the MODX hashing service.
Searches for local options and then prefixes keys with encrypt_ to look for MODX System Settings.
Arguments
- $key
- string
The option key to get a value for. - $options
- arraynull
An optional array of options to look in first. - $default
- mixed
An optional default value to return if no value is set.
Output
- mixed
- The option value or the specified default if not found.
Details
- visibility
- public
- final
- false
- static
- false