Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created December 5, 2020 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/6638b298c44c9da440a1eb774b070f0d to your computer and use it in GitHub Desktop.
Save parzibyte/6638b298c44c9da440a1eb774b070f0d to your computer and use it in GitHub Desktop.
<?php
namespace Parzibyte;
class Security
{
static function hashPassword($password)
{
return password_hash(self::preparePlainPassword($password), PASSWORD_BCRYPT);
}
static function verifyPassword($password, $hash)
{
return password_verify(self::preparePlainPassword($password), $hash);
}
static function preparePlainPassword($password)
{
return hash("sha256", $password);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment