DLight\Application\Hash

Mô tả: utility hash/verify dựa trên password_hash/password_verify.

Public API

  • Hash::default(string $string): string
  • Hash::bcrypt(string $string, array $options = []): string
  • Hash::argon2i(string $string, array $options = []): string
  • Hash::verify(string $string, string $hash, bool $error_on_failure = false): bool

Demo

use DLight\Application\Hash;

$hash = Hash::bcrypt('secret', ['cost' => 12]);

if (Hash::verify('secret', $hash)) {
  // ok
}