Repository navigation
MySQL_VerifyPassword
imshooter edited this page Oct 24, 2026
·
1 revision
Verify a password against an Argon2 or bcrypt hash on a thread of the component, and call a public with context and whether they match.
The public takes (context, bool:match). A hash that cannot be read never matches, and the reason is logged. Verifying costs what the hash cost.
native bool:MySQL_VerifyPassword(const password[], const hash[], const callback[], context = 0);| Parameter | Description | Default |
|---|---|---|
const password[] |
The password. | |
const hash[] |
The hash, from MySQL_HashArgon2, MySQL_HashBcrypt or any other Argon2 or bcrypt library. |
|
const callback[] |
Public to call. | |
context |
Value the public receives. | 0 |
-
truewhen the work started. -
falsewhencallbackis not a public of the script.
It reads the costs and the salt from the hash, so hashes made with other costs, by other programs or by older versions of a script verify the same. Argon2id, Argon2i and Argon2d, and bcrypt $2a$, $2b$, $2x$ and $2y$ are read. The comparison takes the same time whether the password matches or not.
forward OnPasswordChecked(playerid, bool:match);
stock CheckPassword(playerid, const password[], const hash[]) {
MySQL_VerifyPassword(password, hash, "OnPasswordChecked", playerid);
}
public OnPasswordChecked(playerid, bool:match) {
if (!match) {
return SendClientMessage(playerid, -1, "Wrong password.");
}
SpawnPlayer(playerid);
return 1;
}-
MySQL_HashArgon2: Hash a password with Argon2id on a thread of the component, and call a public with
contextand the hash. -
MySQL_HashBcrypt: Hash a password with bcrypt, as
$2b$, on a thread of the component, and call a public withcontextand the hash.
MySQL 0.2.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Queries
- Results
- JSON cells
- Prepared statements
- Passwords
- Errors
- TLS
- Coming from R41
- Performance
Reference
Functions