API / Minn\Auth / FastHash

FastHash final class

Minn\Auth\FastHash · public/minn/src/Minn/Auth/FastHash.php · 23 lines

The reference's hash for high-entropy secrets ("$generic$", WordPress 6.8 and later): a 30-byte keyed BLAKE2b digest (sodium's generic hash, keyed by the scheme's fixed label) in URL-safe base64 without padding. Reset keys and application passwords are stored this way, so a secret minted on either stack verifies on the other. Pinned against hashes the reference made (tests/unit/auth-hashes.php). Without the sodium extension nothing can be hashed or verified this way.

Constants and properties

constPREFIX = '$generic$'
privateKEY = 'wp_fast_hash_6.8+'

Public

staticavailable(): bool#

Whether this PHP can make and check these hashes (the sodium extension).

statichash(string $secret): string#

The "$generic$" hash of a secret.

staticverify(string $secret, string $hash): bool#

Whether a secret matches a "$generic$" hash; false for any other kind of hash.