core/model/modx/hashing/modhashing.class.php

Show: inherited
Table of Contents

This file contains the modHashing service class definition and the modHash abstract implementation class.

Package
modx  
Subpackage
hashing  

\modHash

Package: modx\hashing

Defines the interface for a modHash implementation.

Children
\modPBKDF2
\modMD5
Abstract
Implement a derivative of this class to define an actual hash algorithm implementation.  

Properties

Propertypublic\modHashing  $host= 'null'

A reference to the modHashing service hosting this modHash instance.

Default valuenullDetails
Type
\modHashing
Propertypublicarray  $options= 'array()'

An array of options for the modHash implementation.

Default valuearray()Details
Type
array

Methods

methodpublic__construct( \modHashing $host, array | null $options = array() ) : \modHash

Constructs a new instance of the modHash class.

Parameters
Name Type Description
$host \modHashing

A reference to the modHashing instance

$options array | null

An optional array of configuration options

Returns
Type Description
\modHash A new derivative instance of the modHash class
methodpublicgetOption( 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.

Parameters
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.

Returns
Type Description
mixed The option value or the specified default if not found.
methodpublichash( string $string, array $options = array() ) : mixed
abstract

Generate a hash of the given string using the provided options.

Parameters
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.

Returns
Type Description
mixed The hash result or false on failure.
Details
Abstract
 

\modHashing

Package: modx\hashing

The modX hashing service class.

Properties

Propertyprotectedarray  $_hashes= 'array()'

An array of loaded modHash implementations.

Default valuearray()Details
Type
array
Propertypublic\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.

Default valuenullDetails
Type
\xPDO
Propertypublicarray  $options= 'array()'

An array of options for the hashing service.

Default valuearray()Details
Type
array

Methods

methodpublic__construct( \xPDO $modx, array | null $options = array() ) : void

Constructs a new instance of the modHashing service class.

Parameters
Name Type Description
$modx \xPDO

&$modx A reference to an modX (or xPDO) instance.

$options array | null

An array of options for the hashing service.

methodpublicgetHash( string $key, string $class, array | null $options = array() ) : \modHash | null

Get a hash implementation instance.

The implementation is made available as a member variable of the modHashing service.

Parameters
Name Type Description
$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 | null

An optional array of hash options.

Returns
Type Description
\modHash | null A reference to a modHash instance or null if could not be instantiated.
methodpublicgetOption( 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.

Parameters
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.

Returns
Type Description
mixed The option value or the specified default if not found.
Documentation was generated by DocBlox 0.18.1.