Skip to content

MySQL_HashBcrypt

imshooter edited this page Oct 24, 2026 · 1 revision

Hash a password with bcrypt, as $2b$, on a thread of the component, and call a public with context and the hash.

The public takes (context, const hash[]), as with MySQL_HashArgon2. Only the first 72 bytes of the password count, as bcrypt reads no more.

native bool:MySQL_HashBcrypt(
    const password[],
    const callback[],
    context = 0,
    cost = MYSQL_BCRYPT_COST
);

Parameters

Parameter Description Default
const password[] The password.
const callback[] Public to call.
context Value the public receives. 0
cost Cost, from 4 to 20, each step doubling the time. MYSQL_BCRYPT_COST

Returns

  • true when the work started.
  • false when the cost is out of range, or callback is not a public of the script.

Remarks

The hash is $2b$ with its cost and salt, 60 characters long. Each step of the cost doubles the time a hash takes.

Related

  • MySQL_VerifyPassword: 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.
  • MySQL_HashArgon2: Hash a password with Argon2id on a thread of the component, and call a public with context and the hash.

Clone this wiki locally