DLEncryption

Parent class of all encryption algorithms.

Summary
DLEncryptionParent class of all encryption algorithms.
Private Static Data
$instances(array) An array containing instances of subclasses.
Public Static Data
$algorithms(array) The available encryption algorithms.
Class Construction
__constructCreate a new instance of DLEncryption.
ObjectPoolRetrieve an instance of the request algorithm.
Abstract Methods
DecryptDecrypt the given data using the given key.
EncryptEncrypt the given data using the given key.
Hashing
HashHash the given element using the sha256 algorithm.

Private Static Data

$instances

private static $instances

(array) An array containing instances of subclasses.

Public Static Data

$algorithms

public static $algorithms

(array) The available encryption algorithms.

The available algorithms are

OneAzDGCrypt.
TwoMD5 64.
ThreeAES.

Class Construction

__construct

protected function __construct()

Create a new instance of DLEncryption.  Use ObjectPool to get the necessary instances is recommended.

Returns

(DLEncryption) An instance of DLEncryption.

ObjectPool

public static function &ObjectPool($algorithm)

Retrieve an instance of the request algorithm.

Parameters

$algorithm(string) The algorithm instance to retrieve.

Returns

(DLEncryption) An instance of the selected algorithm, returning NULL if the algorithm doesn’t exist.

Abstract Methods

Decrypt

abstract public function Decrypt($key,
$data)

Decrypt the given data using the given key.

Parameters

$key(string) The key that was used to encrypt the data.
$data(string) The data to be decrypted.

Returns

(mixed) The data after it has been decrypted.

Encrypt

abstract public function Encrypt($key,
$data)

Encrypt the given data using the given key.

Parameters

$key(string) The key to be used to decrypt the data.
$data(mixed) The data to be encrypted.

Returns

(string) The data after it has been encrypted.

Hashing

Hash

protected function Hash($data,  
$length =  0)

Hash the given element using the sha256 algorithm.

Parameters

$data(string) The data to be hashed.
$length(int) Optional and defaults to 0.  The requested length of the returned hashed string.  If this is greater than 0, then the returned string will be of this given length, otherwise, it will be whatever the result of the hash function.

Returns

(string) The data after it has been hashed.

private static $instances
(array) An array containing instances of subclasses.
public static $algorithms
(array) The available encryption algorithms.
protected function __construct()
Create a new instance of DLEncryption.
public static function &ObjectPool($algorithm)
Retrieve an instance of the request algorithm.
abstract public function Decrypt($key,
$data)
Decrypt the given data using the given key.
abstract public function Encrypt($key,
$data)
Encrypt the given data using the given key.
protected function Hash($data,  
$length =  0)
Hash the given element using the sha256 algorithm.