Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 18619 программистов и 1635 роботов. Сейчас ищут 1160 программистов ...
Приступая к работе

Предопределенные константы

Вернуться к: Password Hashing

Перечисленные ниже константы всегда доступны как часть ядра PHP.

PASSWORD_BCRYPT (integer)

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 - 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.

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

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

PASSWORD_DEFAULT (integer)

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

It is worth noting that over time this constant can (and likely will) change. Therefore you should be aware that the length of the resulting hash can change. Therefore, if you use PASSWORD_DEFAULT you should store the resulting hash in a way that can store more than 60 characters (255 is the recomended width).

Values for this constant:

  • PHP 5.5.0 - PASSWORD_BCRYPT



Вернуться к: Password Hashing

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware