Rev 61 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 61 | Rev 62 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
- | 3 | /* |
|
- | 4 | * password_hash_ex() function which integrates crypt() algorithms in password_hash(). |
|
- | 5 | * Revision 2023-02-26 |
|
- | 6 | * Copyright 2023 Daniel Marschall, ViaThinkSoft |
|
- | 7 | * |
|
- | 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
- | 9 | * you may not use this file except in compliance with the License. |
|
- | 10 | * You may obtain a copy of the License at |
|
- | 11 | * |
|
- | 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
- | 13 | * |
|
- | 14 | * Unless required by applicable law or agreed to in writing, software |
|
- | 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
- | 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
- | 17 | * See the License for the specific language governing permissions and |
|
- | 18 | * limitations under the License. |
|
- | 19 | */ |
|
- | 20 | ||
3 | define('PASSWORD_STD_DES', 'std_des'); |
21 | define('PASSWORD_STD_DES', 'std_des'); |
4 | define('PASSWORD_EXT_DES', 'ext_des'); |
22 | define('PASSWORD_EXT_DES', 'ext_des'); |
5 | define('PASSWORD_MD5', 'md5'); |
23 | define('PASSWORD_MD5', 'md5'); |
6 | define('PASSWORD_BLOWFISH', 'blowfish'); |
24 | define('PASSWORD_BLOWFISH', 'blowfish'); |
7 | define('PASSWORD_SHA256', 'sha256'); |
25 | define('PASSWORD_SHA256', 'sha256'); |
Line 76... | Line 94... | ||
76 | // $algo === PASSWORD_ARGON2I |
94 | // $algo === PASSWORD_ARGON2I |
77 | // $algo === PASSWORD_ARGON2ID |
95 | // $algo === PASSWORD_ARGON2ID |
78 | return password_hash($password, $algo, $options); |
96 | return password_hash($password, $algo, $options); |
79 | } |
97 | } |
80 | } |
98 | } |
- | 99 | ||
- | 100 | /* |
|
- | 101 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_STD_DES))); |
|
- | 102 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_EXT_DES))); |
|
- | 103 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_MD5))); |
|
- | 104 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_BLOWFISH))); |
|
- | 105 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_SHA256))); |
|
- | 106 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_SHA512))); |
|
- | 107 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_DEFAULT))); |
|
- | 108 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_BCRYPT))); |
|
- | 109 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_ARGON2I))); |
|
- | 110 | assert(password_verify('test123',password_hash_ex('test123', PASSWORD_ARGON2ID))); |
|
- | 111 | */ |