[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Part of the Joomla Framework Authentication Package 4 * 5 * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE 7 */ 8 9 namespace Joomla\Authentication\Password; 10 11 /** 12 * Password handler for BCrypt hashed passwords 13 * 14 * @since 1.2.0 15 */ 16 class BCryptHandler implements HandlerInterface 17 { 18 /** 19 * Generate a hash for a plaintext password 20 * 21 * @param string $plaintext The plaintext password to validate 22 * @param array $options Options for the hashing operation 23 * 24 * @return string 25 * 26 * @since 1.2.0 27 */ 28 public function hashPassword($plaintext, array $options = []) 29 { 30 return password_hash($plaintext, \PASSWORD_BCRYPT, $options); 31 } 32 33 /** 34 * Check that the password handler is supported in this environment 35 * 36 * @return boolean 37 * 38 * @since 1.2.0 39 */ 40 public static function isSupported() 41 { 42 // Check the password_verify() function exists, either as part of PHP core or through a polyfill 43 return \function_exists('password_verify'); 44 } 45 46 /** 47 * Validate a password 48 * 49 * @param string $plaintext The plain text password to validate 50 * @param string $hashed The password hash to validate against 51 * 52 * @return boolean 53 * 54 * @since 1.2.0 55 */ 56 public function validatePassword($plaintext, $hashed) 57 { 58 return password_verify($plaintext, $hashed); 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |