Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

43
vendor/bedrock/functions/hash.php vendored Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* functions/hash.php
*
* This class is used to salt, hash, and check passwords.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/Core
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Bedrock\Functions;
use TheTempusProject\Canary\Canary as Debug;
class Hash {
/**
* Uses php native hashing scheme to make a password hash.
*
* @param string $password - Validated password input.
* @return string - salted/hashed and ready to use password hash.
*/
public static function make( $password ) {
return password_hash( $password, PASSWORD_DEFAULT );
}
/**
* Uses php native password support to verify the given password.
*
* @param string $password - Password being verified.
* @param string $hash - Saved password hash.
* @return bool
*/
public static function check( $password, $hash ) {
$result = password_verify( $password, $hash );
if ( $result ) {
return true;
}
Debug::info( 'Hash::check: Failed to verify password match.' );
return false;
}
}