|
58 | 58 | | ------------------------------------------------------------------------- |
59 | 59 | | Bcrypt is available in PHP 5.3+ |
60 | 60 | | Argon2 is available in PHP 7.2 |
| 61 | + | Argon2id is available in PHP 7.3 |
61 | 62 | | |
62 | | - | Argon2 is recommended by expert (it is actually the winner of the Password Hashing Competition |
63 | | - | for more information see https://password-hashing.net). So if you can (PHP 7.2), go for it. |
| 63 | + | Bcrypt is the current PHP language default. |
64 | 64 | | |
65 | 65 | | Bcrypt specific: |
66 | 66 | | bcrypt_default_cost settings: This defines how strong the encryption will be. |
|
73 | 73 | | With bcrypt, an example hash of "password" is: |
74 | 74 | | $2y$08$200Z6ZZbp3RAEXoaWcMA6uJOFicwNZaqk4oDhqTUiFXFe63MG.Daa |
75 | 75 | | |
76 | | - | A specific parameter bcrypt_admin_cost is available for user in admin group. |
77 | | - | It is recommended to have a stronger hashing for administrators. |
78 | 76 | | |
79 | 77 | | Argon2 specific: |
80 | 78 | | argon2_default_params settings: This is an array containing the options for the Argon2 algorithm. |
|
95 | 93 | | With argon2, an example hash of "password" is: |
96 | 94 | | $argon2i$v=19$m=1024,t=2,p=2$VEFSSU4wSzh3cllVdE1JZQ$PDeks/7JoKekQrJa9HlfkXIk8dAeZXOzUxLBwNFbZ44 |
97 | 95 | | |
98 | | - | A specific parameter argon2_admin_params is available for user in admin group. |
99 | | - | It is recommended to have a stronger hashing for administrators. |
100 | 96 | | |
101 | 97 | | For more information, check the password_hash function help: http://php.net/manual/en/function.password-hash.php |
102 | 98 | | |
103 | 99 | */ |
104 | | -$config['hash_method'] = 'bcrypt'; // bcrypt or argon2 |
105 | | -$config['bcrypt_default_cost'] = 10; // Set cost according to your server benchmark - but no lower than 10 (default PHP value) |
106 | | -$config['bcrypt_admin_cost'] = 12; // Cost for user in admin group |
| 100 | +$config['hash_method'] = 'bcrypt'; // bcrypt, argon2, or argon2id |
| 101 | +$config['bcrypt_default_cost'] = defined('PASSWORD_BCRYPT_DEFAULT_COST') ? PASSWORD_BCRYPT_DEFAULT_COST : 10; // Set cost according to your server benchmark - but no lower than 10 (default PHP value) |
107 | 102 | $config['argon2_default_params'] = [ |
108 | | - 'memory_cost' => 1 << 12, // 4MB |
109 | | - 'time_cost' => 2, |
110 | | - 'threads' => 2 |
111 | | -]; |
112 | | -$config['argon2_admin_params'] = [ |
113 | | - 'memory_cost' => 1 << 14, // 16MB |
114 | | - 'time_cost' => 4, |
115 | | - 'threads' => 2 |
| 103 | + 'memory_cost' => defined('PASSWORD_ARGON2_DEFAULT_MEMORY_COST') ? PASSWORD_ARGON2_DEFAULT_MEMORY_COST : 1 << 12, |
| 104 | + 'time_cost' => defined('PASSWORD_ARGON2_DEFAULT_TIME_COST') ? PASSWORD_ARGON2_DEFAULT_TIME_COST : 2, |
| 105 | + 'threads' => defined('PASSWORD_ARGON2_DEFAULT_THREADS') ? PASSWORD_ARGON2_DEFAULT_THREADS : 2 |
116 | 106 | ]; |
117 | 107 |
|
| 108 | +// NOTE - the admin specific hashing config fields are no longer used, all users share the same hashing params now |
| 109 | + |
118 | 110 | /* |
119 | 111 | | ------------------------------------------------------------------------- |
120 | 112 | | Authentication options. |
|
0 commit comments