class PBKDF2 extends PasswordEncryptor_PHPHash (View source)

Provides Password-Based Key Derivation Function hashing for passwords, using the provided algorithm (default is SHA512), which is NZISM compliant under version 3.2 section 17.2.

Properties

protected $algorithm from  PasswordEncryptor_PHPHash
protected int $iterations

The number of internal iterations for hash_pbkdf2() to perform for the derivation. Please note that if you change this from the default value you will break existing hashes stored in the database, so these would need to be regenerated.

Methods

public static 
array
get_encryptors()

No description

public static 
create_for_algorithm(string $algorithm)

No description

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

Return a string value stored in the Member->Password property.

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

Return a string value stored in the Member->Salt property.

public
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 PasswordEncryptor_LegacyPHPHash and PasswordEncryptor_Blowfish

public
__construct(string $algorithm, int $iterations = null)

No description

public
string
getAlgorithm()

No description

public
int
getIterations()

No description

Details

static array get_encryptors()

No description

Return Value

array

Map of encryptor code to the used class.

static PasswordEncryptor create_for_algorithm(string $algorithm)

No description

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 Member->Password property.

The password should be hashed with 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 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 PasswordEncryptor_LegacyPHPHash and PasswordEncryptor_Blowfish

Parameters

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

Return Value

bool

__construct(string $algorithm, int $iterations = null)

No description

Parameters

string $algorithm

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

int $iterations

Exceptions

Exception

string getAlgorithm()

No description

Return Value

string

int getIterations()

No description

Return Value

int