Parent class of all encryption algorithms.
| DLEncryption | Parent 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 | |
| __construct | Create a new instance of DLEncryption. |
| ObjectPool | Retrieve an instance of the request algorithm. |
| Abstract Methods | |
| Decrypt | Decrypt the given data using the given key. |
| Encrypt | Encrypt the given data using the given key. |
| Hashing | |
| Hash | Hash the given element using the sha256 algorithm. |
protected function __construct()
Create a new instance of DLEncryption. Use ObjectPool to get the necessary instances is recommended.
(DLEncryption) An instance of DLEncryption.
protected function Hash( $data, $length = 0 )
Hash the given element using the sha256 algorithm.
| $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. |
(string) The data after it has been hashed.
(array) An array containing instances of subclasses.
private static $instances
(array) The available encryption algorithms.
public static $algorithms
Create a new instance of DLEncryption.
protected function __construct()
Retrieve an instance of the request algorithm.
public static function &ObjectPool( $algorithm )
Decrypt the given data using the given key.
abstract public function Decrypt( $key, $data )
Encrypt the given data using the given key.
abstract public function Encrypt( $key, $data )
Hash the given element using the sha256 algorithm.
protected function Hash( $data, $length = 0 )