class PasswordEncryptor_PHPHash extends PasswordEncryptor (View source)

Encryption using built-in hash types in PHP.

Please note that the implemented algorithms depend on the PHP distribution and architecture.

Properties

static private array $encryptors from  PasswordEncryptor

Methods

static array
get_encryptors()

No description

create_for_algorithm(string $algorithm)

No description

string
encrypt(string $password, string $salt = null, Member $member = null)

Return a string value stored in the {@link Member->Password} property.

string
salt(string $password, Member $member = null)

Return a string value stored in the {@link Member->Salt} property.

bool
check(string $hash, string $password, string $salt = null, Member $member = null)

This usually just returns a strict string comparison, but is necessary for retain compatibility with password hashed with flawed algorithms - see {@link PasswordEncryptor_LegacyPHPHash} and {@link PasswordEncryptor_Blowfish}

__construct(string $algorithm)

No description

string
getAlgorithm()

No description

Details

static array get_encryptors()

Return Value

array

Map of encryptor code to the used class.

static PasswordEncryptor create_for_algorithm(string $algorithm)

Parameters

string $algorithm

Return Value

PasswordEncryptor

Exceptions

PasswordEncryptor_NotFoundException

string encrypt(string $password, string $salt = null, Member $member = null)

Return a string value stored in the {@link Member->Password} property.

The password should be hashed with {@link salt()} if applicable.

Parameters

string $password

Cleartext password to be hashed

string $salt

(Optional)

Member $member

(Optional)

Return Value

string

Maximum of 512 characters.

string salt(string $password, Member $member = null)

Return a string value stored in the {@link Member->Salt} property.

Parameters

string $password

Cleartext password

Member $member

(Optional)

Return Value

string

Maximum of 50 characters

bool check(string $hash, string $password, string $salt = null, Member $member = null)

This usually just returns a strict string comparison, but is necessary for retain compatibility with password hashed with flawed algorithms - see {@link PasswordEncryptor_LegacyPHPHash} and {@link PasswordEncryptor_Blowfish}

Parameters

string $hash
string $password
string $salt
Member $member

Return Value

bool

__construct(string $algorithm)

Parameters

string $algorithm

A PHP built-in hashing algorithm as defined by hash_algos()

Exceptions

Exception

string getAlgorithm()

Return Value

string