Repository navigation
Passwords
imshooter edited this page Nov 29, 2026
·
1 revision
Passwords are hashed and verified on up to four threads of the plugin, apart from the connections, so a login never holds the game thread. Argon2id uses AVX2 when the processor has it.
forward OnPasswordHashed(playerid, const hash[]);
forward OnPasswordChecked(playerid, bool:match);
stock Register(playerid, const password[]) {
mysql_hash_argon2(password, "OnPasswordHashed", "i", playerid);
}
public OnPasswordHashed(playerid, const hash[]) {
printf("Store %s", hash);
return 1;
}
stock Login(playerid, const password[], const hash[]) {
mysql_verify_password(password, hash, "OnPasswordChecked", "i", playerid);
}
public OnPasswordChecked(playerid, bool:match) {
if (!match) {
Kick(playerid);
}
return 1;
}The public takes its values first, then the hash or whether the password matched. A hash fits in an array of MYSQL_HASH_LENGTH cells.
| Native | Work |
|---|---|
| mysql_hash_argon2 | an Argon2id hash, at the costs of mysql_argon2_costs, 19 MiB and two passes by default |
| mysql_hash_bcrypt | a $2b$ bcrypt hash, at the cost of mysql_bcrypt_cost, 12 by default |
| mysql_verify_password | checks a password against an Argon2 or bcrypt hash from any library |
mysql 0.6.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Queries
- The cache
- JSON cells
- Prepared statements
- Transactions
- The ORM
- Passwords
- Errors
- TLS
- Coming from another plugin
- Performance
Reference
Functions
Connections
Queries
Cache
- cache_get_row_count
- cache_get_field_count
- cache_get_result_count
- cache_get_field_name
- cache_get_field_type
- cache_get_field_index
- cache_set_result
- cache_get_value_index
- cache_get_value_index_int
- cache_get_value_index_float
- cache_get_value_index_bool
- cache_is_value_index_null
- cache_get_value_name
- cache_get_value_name_int
- cache_get_value_name_float
- cache_get_value_name_bool
- cache_is_value_name_null
- cache_get_row
- cache_save
- cache_delete
- cache_set_active
- cache_unset_active
- cache_is_any_active
- cache_is_valid
- cache_affected_rows
- cache_insert_id
- cache_warning_count
- cache_get_query_exec_time
- cache_get_query_string
- cache_get_errno