TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt Class Reference
Inheritance diagram for TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt:
TYPO3\CMS\Saltedpasswords\Salt\Md5Salt TYPO3\CMS\Saltedpasswords\Salt\AbstractSalt TYPO3\CMS\Saltedpasswords\Salt\SaltInterface

Public Member Functions

 getHashCount ()
 
 getMaxHashCount ()
 
 isAvailable ()
 
 getMinHashCount ()
 
 getSaltLength ()
 
 getSetting ()
 
 isHashUpdateNeeded ($saltedPW)
 
 isValidSalt ($salt)
 
 isValidSaltedPW ($saltedPW)
 
 setHashCount ($hashCount=null)
 
 setMaxHashCount ($maxHashCount=null)
 
 setMinHashCount ($minHashCount=null)
 
- Public Member Functions inherited from TYPO3\CMS\Saltedpasswords\Salt\Md5Salt
 checkPassword ($plainPW, $saltedHashPW)
 
 getHashedPassword ($password, $salt=null)
 
 isAvailable ()
 
 getSaltLength ()
 
 getSetting ()
 
 isHashUpdateNeeded ($passString)
 
 isValidSalt ($salt)
 
 isValidSaltedPW ($saltedPW)
 
- Public Member Functions inherited from TYPO3\CMS\Saltedpasswords\Salt\AbstractSalt
 base64Encode ($input, $count)
 

Public Attributes

const HASH_COUNT = 7
 
const MAX_HASH_COUNT = 17
 
const MIN_HASH_COUNT = 4
 
- Public Attributes inherited from TYPO3\CMS\Saltedpasswords\Salt\Md5Salt
const ITOA64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
 

Protected Member Functions

 applySettingsToSalt ($salt)
 
 getCountLog2 ($setting)
 
- Protected Member Functions inherited from TYPO3\CMS\Saltedpasswords\Salt\Md5Salt
 applySettingsToSalt ($salt)
 
 getGeneratedSalt ()
 
 getItoa64 ()
 
 getSaltSuffix ()
 
- Protected Member Functions inherited from TYPO3\CMS\Saltedpasswords\Salt\AbstractSalt
 applySettingsToSalt ($salt)
 
 getGeneratedSalt ()
 
 getItoa64 ()
 
 getSetting ()
 
 getLengthBase64FromBytes ($byteLength)
 

Static Protected Attributes

static $hashCount
 
static $maxHashCount
 
static $minHashCount
 
static $saltLengthBlowfish = 16
 
static $settingBlowfish = '$2a$'
 
- Static Protected Attributes inherited from TYPO3\CMS\Saltedpasswords\Salt\Md5Salt
static $saltLengthMD5 = 6
 
static $saltSuffixMD5 = '$'
 
static $settingMD5 = '$1$'
 

Detailed Description

Class that implements Blowfish salted hashing based on PHP's crypt() function.

Warning: Blowfish salted hashing with PHP's crypt() is not available on every system.

Definition at line 24 of file BlowfishSalt.php.

Member Function Documentation

◆ applySettingsToSalt()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::applySettingsToSalt (   $salt)
protected

Method applies settings (prefix, hash count) to a salt.

Overwrites Md5Salt::applySettingsToSalt() with Blowfish specifics.

Parameters
string$saltA salt to apply setting to
Returns
string Salt with setting

Definition at line 90 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getHashCount(), TYPO3\CMS\Saltedpasswords\Salt\AbstractSalt\getLengthBase64FromBytes(), TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getSaltLength(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getSetting().

◆ getCountLog2()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getCountLog2 (   $setting)
protected

Parses the log2 iteration count from a stored hash or setting string.

Parameters
string$settingComplete hash or a hash's setting string or to get log2 iteration count from
Returns
int Used hashcount for given hash string

Definition at line 107 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getSetting().

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isHashUpdateNeeded().

◆ getHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getHashCount ( )

Method returns log2 number of iterations for password stretching.

Returns
int log2 number of iterations for password stretching
See also
HASH_COUNT
$hashCount
setHashCount()

Definition at line 127 of file BlowfishSalt.php.

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\applySettingsToSalt(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isHashUpdateNeeded().

◆ getMaxHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getMaxHashCount ( )

Method returns maximum allowed log2 number of iterations for password stretching.

Returns
int Maximum allowed log2 number of iterations for password stretching
See also
MAX_HASH_COUNT
$maxHashCount
setMaxHashCount()

Definition at line 140 of file BlowfishSalt.php.

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\setHashCount().

◆ getMinHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getMinHashCount ( )

Method returns minimum allowed log2 number of iterations for password stretching.

Returns
int Minimum allowed log2 number of iterations for password stretching
See also
MIN_HASH_COUNT
$minHashCount
setMinHashCount()

Definition at line 163 of file BlowfishSalt.php.

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\setHashCount().

◆ getSaltLength()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getSaltLength ( )

Returns length of a Blowfish salt in bytes.

Overwrites Md5Salt::getSaltLength() with Blowfish specifics.

Returns
int Length of a Blowfish salt in bytes

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 176 of file BlowfishSalt.php.

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\applySettingsToSalt(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isValidSalt().

◆ getSetting()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::getSetting ( )

Returns setting string of Blowfish salted hashes.

Overwrites Md5Salt::getSetting() with Blowfish specifics.

Returns
string Setting string of Blowfish salted hashes

Definition at line 189 of file BlowfishSalt.php.

Referenced by TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\applySettingsToSalt(), TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getCountLog2(), TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isValidSalt(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isValidSaltedPW().

◆ isAvailable()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::isAvailable ( )

Returns whether all prerequisites for the hashing methods are matched

Returns
bool Method available

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 150 of file BlowfishSalt.php.

◆ isHashUpdateNeeded()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::isHashUpdateNeeded (   $saltedPW)

Checks whether a user's hashed password needs to be replaced with a new hash.

This is typically called during the login process when the plain text password is available. A new hash is needed when the desired iteration count has changed through a change in the variable $hashCount or HASH_COUNT.

Parameters
string$saltedPWSalted hash to check if it needs an update
Returns
bool TRUE if salted hash needs an update, otherwise FALSE

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 205 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getCountLog2(), TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getHashCount(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isValidSalt().

◆ isValidSalt()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::isValidSalt (   $salt)

◆ isValidSaltedPW()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::isValidSaltedPW (   $saltedPW)

Method determines if a given string is a valid salted hashed password.

Parameters
string$saltedPWString to check
Returns
bool TRUE if it's valid salted hashed password, otherwise FALSE

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 255 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getSetting(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\isValidSalt().

◆ setHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::setHashCount (   $hashCount = null)

Method sets log2 number of iterations for password stretching.

Parameters
int$hashCountlog2 number of iterations for password stretching to set
See also
HASH_COUNT
$hashCount
getHashCount()

Definition at line 273 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\$hashCount, TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getMaxHashCount(), and TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\getMinHashCount().

◆ setMaxHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::setMaxHashCount (   $maxHashCount = null)

Method sets maximum allowed log2 number of iterations for password stretching.

Parameters
int$maxHashCountMaximum allowed log2 number of iterations for password stretching to set
See also
MAX_HASH_COUNT
$maxHashCount
getMaxHashCount()

Definition at line 286 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\$maxHashCount.

◆ setMinHashCount()

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::setMinHashCount (   $minHashCount = null)

Method sets minimum allowed log2 number of iterations for password stretching.

Parameters
int$minHashCountMinimum allowed log2 number of iterations for password stretching to set
See also
MIN_HASH_COUNT
$minHashCount
getMinHashCount()

Definition at line 299 of file BlowfishSalt.php.

References TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt\$minHashCount.

Member Data Documentation

◆ $hashCount

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::$hashCount
staticprotected

◆ $maxHashCount

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::$maxHashCount
staticprotected

◆ $minHashCount

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::$minHashCount
staticprotected

◆ $saltLengthBlowfish

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::$saltLengthBlowfish = 16
staticprotected

Definition at line 72 of file BlowfishSalt.php.

◆ $settingBlowfish

TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::$settingBlowfish = '$2a$'
staticprotected

Definition at line 79 of file BlowfishSalt.php.

◆ HASH_COUNT

const TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::HASH_COUNT = 7

The default log2 number of iterations for password stretching.

Definition at line 29 of file BlowfishSalt.php.

◆ MAX_HASH_COUNT

const TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::MAX_HASH_COUNT = 17

The default maximum allowed log2 number of iterations for password stretching.

Definition at line 35 of file BlowfishSalt.php.

◆ MIN_HASH_COUNT

const TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::MIN_HASH_COUNT = 4

The default minimum allowed log2 number of iterations for password stretching.

Definition at line 41 of file BlowfishSalt.php.