PHP Class ParagonIE\Halite\Password

Inheritance: implements ParagonIE\Halite\Contract\PasswordInterface
Show file Open project: paragonie/halite Class Usage Examples

Public Methods

Method Description
hash ( HiddenString $password, EncryptionKey $secretKey, string $level = KeyFactory::INTERACTIVE ) : string Hash then encrypt a password
needsRehash ( string $stored, EncryptionKey $secretKey, string $level = KeyFactory::INTERACTIVE ) : boolean Is this password hash stale?
verify ( HiddenString $password, string $stored, EncryptionKey $secretKey ) : boolean Decrypt then verify a password

Protected Methods

Method Description
getConfig ( string $stored ) : SymmetricConfig Get the configuration for this version of halite

Method Details

getConfig() protected static method

Get the configuration for this version of halite
protected static getConfig ( string $stored ) : SymmetricConfig
$stored string A stored password hash
return SymmetricConfig

hash() public static method

Hash then encrypt a password
public static hash ( HiddenString $password, EncryptionKey $secretKey, string $level = KeyFactory::INTERACTIVE ) : string
$password HiddenString The user's password
$secretKey EncryptionKey The master key for all passwords
$level string The security level for this password
return string An encrypted hash to store

needsRehash() public static method

Is this password hash stale?
public static needsRehash ( string $stored, EncryptionKey $secretKey, string $level = KeyFactory::INTERACTIVE ) : boolean
$stored string Encrypted password hash
$secretKey EncryptionKey The master key for all passwords
$level string The security level for this password
return boolean Do we need to regenerate the hash or ciphertext?

verify() public static method

Decrypt then verify a password
public static verify ( HiddenString $password, string $stored, EncryptionKey $secretKey ) : boolean
$password HiddenString The user's password
$stored string The encrypted password hash
$secretKey EncryptionKey The master key for all passwords
return boolean Is this password valid?