MediaWiki master
MediaWiki\Password\InvalidPassword Class Reference

Represents an invalid password hash. More...

Inherits MediaWiki\Password\Password.

Collaboration diagram for MediaWiki\Password\InvalidPassword:

Public Member Functions

 crypt (string $plaintext)
 Hash a password and store the result in this object.
 
 needsUpdate ()
 Determine if the hash needs to be updated.
 
 toString ()
 Convert this hash to a string that can be stored in the database.
 
 verify (string $password)
 Checks whether the given password matches the hash stored in this object.
 
- Public Member Functions inherited from MediaWiki\Password\Password
 __construct (PasswordFactory $factory, array $config, ?string $hash=null)
 Construct the Password object using a string hash.
 
 getType ()
 Get the type name of the password.
 

Additional Inherited Members

- Protected Member Functions inherited from MediaWiki\Password\Password
 assertIsSafeSize (string $hash)
 Assert that hash will fit in a tinyblob field.
 
 isSupported ()
 Whether current password type is supported on this system.
 
 parseHash (?string $hash)
 Perform any parsing necessary on the hash to see if the hash is valid and/or to perform logic for seeing if the hash needs updating.
 
- Protected Attributes inherited from MediaWiki\Password\Password
array $config
 Array of configuration variables injected from the constructor.
 
PasswordFactory $factory
 Factory that created the object.
 
string null $hash
 String representation of the hash without the type.
 

Detailed Description

Represents an invalid password hash.

It is represented as the empty string (i.e., a password hash with no type).

No two invalid passwords are equal. Comparing anything to an invalid password will return false.

Since
1.24

Definition at line 36 of file InvalidPassword.php.

Member Function Documentation

◆ crypt()

MediaWiki\Password\InvalidPassword::crypt ( string $password)

Hash a password and store the result in this object.

The result of the password hash should be put into the internal state of the hash object.

Parameters
string$passwordPassword to hash
Exceptions
PasswordErrorIf an internal error occurs in hashing

Reimplemented from MediaWiki\Password\Password.

Definition at line 37 of file InvalidPassword.php.

◆ needsUpdate()

MediaWiki\Password\InvalidPassword::needsUpdate ( )

Determine if the hash needs to be updated.

Returns
bool True if needs update, false otherwise

Reimplemented from MediaWiki\Password\Password.

Definition at line 48 of file InvalidPassword.php.

◆ toString()

MediaWiki\Password\InvalidPassword::toString ( )

Convert this hash to a string that can be stored in the database.

The resulting string should be considered the serialized representation of this hash, i.e., if the return value were recycled back into PasswordFactory::newFromCiphertext, the returned object would be equivalent to this; also, if two objects return the same value from this function, they are considered equivalent.

Returns
string
Exceptions
PasswordErrorif password cannot be serialized to fit a tinyblob.

Reimplemented from MediaWiki\Password\Password.

Definition at line 40 of file InvalidPassword.php.

◆ verify()

MediaWiki\Password\InvalidPassword::verify ( string $password)

Checks whether the given password matches the hash stored in this object.

Parameters
string$passwordPassword to check
Returns
bool

Reimplemented from MediaWiki\Password\Password.

Definition at line 44 of file InvalidPassword.php.


The documentation for this class was generated from the following file: