Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

password_hash()

3 tags 1 category

password_hash() — Creates a password hash.

password_hash creates a new password hash using a strong one-way hashing algorithm.

PASSWORD_DEFAULT – Use the bcrypt algorithm (default as of PHP 5.5.0). Note that this constant is designed to change over time as new and stronger algorithms are added to PHP. For that reason, the length of the result from using this identifier can change over time. Therefore, it is recommended to store the result in a database column that can expand beyond 60 bytes (255 bytes would be a good choice). PASSWORD_BCRYPT – Use the bcrypt algorithm to create the hash. This will produce a standard crypt compatible hash using the $2y$ identifier. PASSWORD_ARGON2I – Use the Argon2i hashing algorithm to create the hash. This algorithm is only available if PHP has been compiled with Argon2 support. PASSWORD_ARGON2ID – Use the Argon2id hashing algorithm to create the hash.

Inputs: password: The user’s password. algo: A password algorithm constant denoting the algorithm to use when hashing the password. options: An associative array containing options. See the password algorithm constants for documentation on the supported options for each algorithm.

Returns: Returns the hashed password. The used algorithm, cost and salt are returned as part of the hash. Therefore, all information that’s needed to verify the hash is included in it. This allows the password_verify function to verify the hash without needing separate storage for the salt or algorithm information.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…