TYPO3 CMS  TYPO3_6-2
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 tx_saltedpasswords_salts_blowfish

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

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! 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.

Author
Marcus Krause <marcus::exp2009.info>

Definition at line 26 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 89 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
integer Used hashcount for given hash string

Definition at line 105 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
integer log2 number of iterations for password stretching
See also
HASH_COUNT
$hashCount
setHashCount()

Definition at line 124 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
integer Maximum allowed log2 number of iterations for password stretching
See also
MAX_HASH_COUNT
$maxHashCount
setMaxHashCount()

Definition at line 136 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
integer Minimum allowed log2 number of iterations for password stretching
See also
MIN_HASH_COUNT
$minHashCount
setMinHashCount()

Definition at line 157 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
integer Length of a Blowfish salt in bytes

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 169 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 181 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
boolean Method available

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 145 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
boolean TRUE if salted hash needs an update, otherwise FALSE

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 196 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
boolean TRUE if it's valid salted hashed password, otherwise FALSE

Implements TYPO3\CMS\Saltedpasswords\Salt\SaltInterface.

Definition at line 244 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
integer$hashCountlog2 number of iterations for password stretching to set
See also
HASH_COUNT
$hashCount
getHashCount()

Definition at line 261 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
integer$maxHashCountMaximum allowed log2 number of iterations for password stretching to set
See also
MAX_HASH_COUNT
$maxHashCount
getMaxHashCount()

Definition at line 273 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
integer$minHashCountMinimum allowed log2 number of iterations for password stretching to set
See also
MIN_HASH_COUNT
$minHashCount
getMinHashCount()

Definition at line 285 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 71 of file BlowfishSalt.php.

◆ $settingBlowfish

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

Definition at line 78 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 31 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 36 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.