Argon2CheckHash()

edit

Verifies a password against an Argon2 hash. For new code, prefer Argon2Verify() for consistent naming.

Introduced: 5.3.8.43

Requires Extension: Crypto Extension

Argon2CheckHash( input=string, hash=string );

Returns: Boolean

Argument Description
input
string, required
edit

Input string.

hash
string, required
edit

Argon2 hash to compare against input string

Usage Notes

edit

This function is provided by the bundled argon2 extension and also by the crypto extension (which replaces it). For new code, prefer Argon2Verify() for consistent naming with BCryptVerify() and SCryptVerify().

Examples

edit
    secret = createUUID();
    dump(var=secret, label="input string");
    hashed = generateArgon2Hash(secret);
    dump(var=hashed, label="generateArgon2Hash");
    decoded= argon2checkhash(secret, hashed);
    dump(var=decoded, label="argon2checkhash matches");

See also