mirror of
https://github.com/zoe-may/TDoG-Skin.git
synced 2024-11-28 08:12:19 +08:00
27 lines
553 B
PHP
Executable File
27 lines
553 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Services\Cipher;
|
|
|
|
abstract class BaseCipher
|
|
{
|
|
/**
|
|
* Encrypt given string with given salt.
|
|
*
|
|
* @param string $value
|
|
* @param string $salt
|
|
*/
|
|
abstract public function hash($value, $salt = '');
|
|
|
|
/**
|
|
* Verify that the given hash matches the given password.
|
|
*
|
|
* @param string $password
|
|
* @param string $hash
|
|
* @param string $salt
|
|
*/
|
|
public function verify($password, $hash, $salt = '')
|
|
{
|
|
return hash_equals($hash, $this->hash($password, $salt));
|
|
}
|
|
}
|