blessing-skin-server/app/Services/Cipher/BaseCipher.php
2020-06-02 15:46:04 +08:00

27 lines
554 B
PHP

<?php
namespace App\Services\Cipher;
abstract class BaseCipher
{
/**
* Encrypt given string with given salt.
*
* @param string $value
* @param string $salt
*/
public abstract 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));
}
}