Mithril as main method

This commit is contained in:
2017-10-25 12:08:41 +07:00
parent 6040809710
commit d1d5ee1b0c
157 changed files with 19593 additions and 716 deletions

View File

@@ -1,19 +1,20 @@
<?php
namespace Core;
use Defuse\Crypto\Key;
class Hash
{
public static function make($string, $salt = '')
{
// return hash('sha256', $string . $salt);
// return password_hash($string, PASSWORD_BCRYPT);
return crypt($string, $salt);
}
public static function salt()
{
// return mcrypt_create_iv($length);
return uniqid(mt_rand());
$salt = Key::createNewRandomKey();
$salt = $salt->saveToAsciiSafeString();
return $salt;
}
public static function unique()
@@ -23,8 +24,6 @@ class Hash
public static function compare($string, $salt, $hash)
{
// return (Hash::make($string, $salt) === $hash) ? true : false;
// return password_verify($string, $hash);
return hash_equals($hash, Hash::make($string, $salt));
}
}