PHP Class Contao\Encryption

The class can be used to encrypt and decrypt data based on the encryption string that is set during the Contao installation. Usage: $encrypted = Encryption::encrypt('Leo Feyer'); $decrypted = Encryption::decrypt($encrypted);
Afficher le fichier Open project: contao/core-bundle Class Usage Examples

Protected Properties

Свойство Type Description
$objInstance Encryption Object instance (Singleton)
$resTd resource Mcrypt resource

Méthodes publiques

Méthode Description
__clone ( ) Prevent cloning of the object (Singleton)
decrypt ( mixed $varValue, string $strKey = null ) : string Decrypt a value
encrypt ( mixed $varValue, string $strKey = null ) : string Encrypt a value
getInstance ( ) : Encryption Return the object instance (Singleton)
hash ( string $strPassword ) : string Generate a password hash
test ( string $strHash ) : boolean Test whether a password hash has been generated with crypt()
verify ( string $strPassword, string $strHash ) : boolean Verify a readable password against a password hash

Méthodes protégées

Méthode Description
__construct ( ) Initialize the encryption module
initialize ( ) Initialize the encryption module

Method Details

__clone() final public méthode

Prevent cloning of the object (Singleton)
Deprecation: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Encryption class is now static.
final public __clone ( )

__construct() protected méthode

Initialize the encryption module
Deprecation: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Encryption class is now static.
protected __construct ( )

decrypt() public static méthode

Decrypt a value
public static decrypt ( mixed $varValue, string $strKey = null ) : string
$varValue mixed The value to decrypt
$strKey string An optional encryption key
Résultat string The decrypted value

encrypt() public static méthode

Encrypt a value
public static encrypt ( mixed $varValue, string $strKey = null ) : string
$varValue mixed The value to encrypt
$strKey string An optional encryption key
Résultat string The encrypted value

getInstance() public static méthode

Return the object instance (Singleton)
Deprecation: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Encryption class is now static.
public static getInstance ( ) : Encryption
Résultat Encryption

hash() public static méthode

Generate a password hash
public static hash ( string $strPassword ) : string
$strPassword string The unencrypted password
Résultat string The encrypted password

initialize() protected static méthode

Initialize the encryption module
protected static initialize ( )

test() public static méthode

Test whether a password hash has been generated with crypt()
public static test ( string $strHash ) : boolean
$strHash string The password hash
Résultat boolean True if the password hash has been generated with crypt()

verify() public static méthode

Verify a readable password against a password hash
See also: https://github.com/ircmaxell/password_compat
public static verify ( string $strPassword, string $strHash ) : boolean
$strPassword string The readable password
$strHash string The password hash
Résultat boolean True if the password could be verified

Property Details

$objInstance protected_oe static_oe property

Object instance (Singleton)
protected static Encryption,contao $objInstance
Résultat Encryption

$resTd protected_oe static_oe property

Mcrypt resource
protected static resource $resTd
Résultat resource