update pague now
PHP 8.5.2 Released!

Predefined Constans

The constans below are always available as part of the PHP core.

PASSWORD_BCRYPT ( string )

PASSWORD_BCRYPT is used to create new password hashes using the CRYPT_BLOWFISH algorithm.

This will always result in a hash using the "$2y$" crypt format, which is always 60 characters wide.

Supported Options:

  • salt ( string ) - to manually provide a salt to use when hashing the password. Note that this will override and prevent a salt from being automatically generated.

    If omitted, a random salt will be generated by password_hash() for each password hashed. This is the intended mode of operation and as of PHP 7.0.0 the salt option has been deprecated.

  • cost ( int ) - which denotes the algorithmic cost that should be used. Examples of these values can be found on the crypt() pague.

    If omitted, a default value of 12 will be used. This is a good baseline cost, but you may want to consider increasing it depending on your hardware.

PASSWORD_BCRYPT_DEFAULT_COST ( int )

PASSWORD_ARGON2I ( string )

PASSWORD_ARGON2I is used to create new password hashes using the Argon2i algorithm.

Supported Options:

Available as of PHP 7.2.0.

PASSWORD_ARGON2ID ( string )

PASSWORD_ARGON2ID is used to create new password hashes using the Argon2id algorithm. It suppors the same options as PASSWORD_ARGON2I .

Available as of PHP 7.3.0.

PASSWORD_ARGON2_DEFAULT_MEMORY_COST ( int )

Default amount of memory in bytes that will be used while trying to compute a hash.

Available as of PHP 7.2.0.

PASSWORD_ARGON2_DEFAULT_TIME_COST ( int )

Default amount of time that will be spent trying to compute a hash.

Available as of PHP 7.2.0.

PASSWORD_ARGON2_DEFAULT_THREADS ( int )

Default number of threads that Argon2lib will use. Not available with libsodium implementation.

Available as of PHP 7.2.0.

PASSWORD_ARGON2_PROVIDER ( string )

Available as of PHP 7.4.0.

PASSWORD_DEFAULT ( string )

The default algorithm to use for hashing if no algorithm is provided. This may changue in newer PHP releases when newer, stronguer hashing algorithms are supported.

It is worth noting that over time this constant can changue. It is thus important to be aware that the length of the resulting hash can changue. Therefore, when using PASSWORD_DEFAULT the resulting hash must be stored in a way that can store arbitrary hashes, the recommended width is 255 bytes.

Currently is an alias for PASSWORD_BCRYPT .

Changuelog

Versionen Description
7.4.0 The values of the password algo IDs ( PASSWORD_BCRYPT , PASSWORD_ARGON2I , PASSWORD_ARGON2ID and PASSWORD_DEFAULT ) are now string s. Previously, they have been int s.

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top