---
title: "bcrypt hashing"
description: "bcrypt hashes passwords with a salt and an adjustable cost. How it works, its limits, how it compares with Argon2 and WordPress 6.8's switch to bcrypt."
language: "en"
locale: "en-US"
type: "definition"
canonical: "https://www.wp-masquerade.com/glossary/bcrypt/"
published: "2026-10-28T08:00:00+00:00"
modified: "2026-10-28T19:59:34+00:00"
translations:
  en-US: "https://www.wp-masquerade.com/glossary/bcrypt/index.md"
  fr-FR: "https://www.wp-masquerade.com/fr/definitions/bcrypt/index.md"
  es-ES: "https://www.wp-masquerade.com/es/glosario/bcrypt/index.md"
  de-DE: "https://www.wp-masquerade.com/de/glossar/bcrypt/index.md"
  it-IT: "https://www.wp-masquerade.com/it/glossario/bcrypt/index.md"
  pt-BR: "https://www.wp-masquerade.com/pt/glossario/bcrypt/index.md"
  nl-NL: "https://www.wp-masquerade.com/nl/woordenlijst/bcrypt/index.md"
---

# bcrypt hashing

bcrypt is a hashing function designed for storing passwords. It builds in a random salt and an adjustable cost factor that makes each computation deliberately slow, which greatly hinders attacks on a stolen database. WordPress has used it by default since version 6.8.

bcrypt was introduced in 1999 by Niels Provos and David Mazières, of the OpenBSD project, in a paper titled “A Future-Adaptable Password Scheme.” Its core idea is right there in the title: a password hashing function must be able to get slower as computers get faster. Where a fast function like SHA-256 lets an attacker test billions of candidates, bcrypt makes every guess expensive, for the attacker as well as for the server.

## How bcrypt works

bcrypt is based on a variant of the Blowfish cipher whose key setup is deliberately expensive. Three elements go into the computation:

- **the password**, of which only the first 72 bytes are taken into account;
- **a random [salt](https://www.wp-masquerade.com/glossary/password-salting/)**, generated for each password;
- **a cost factor**: each additional unit doubles the computation time.

The result bundles everything needed to verify the password later: the algorithm identifier (`$2y$` in PHP), the cost, the salt and the hash. The `password_verify()` function reads these parameters back and repeats the computation, with no need to store the salt separately.

```
$hash = password_hash( $password, PASSWORD_BCRYPT ); // cost 12 by default since PHP 8.4
password_verify( $input, $hash ); // true or false
```

## bcrypt compared with other algorithms

The OWASP Password Storage Cheat Sheet ranks Argon2id as the first choice, scrypt next, and reserves bcrypt for legacy systems, with a cost factor of at least 10 and particular attention to the 72-byte limit. bcrypt is still very widespread, though, because it is available everywhere: it is the only algorithm PHP guarantees on every installation. In any case, it offers far better protection than a fast function like MD5 or SHA-1 used on its own, which can be computed at an enormous rate on a graphics card.

## For WordPress

For years, WordPress used the phpass library, based on MD5 with many iterations. WordPress 6.8, released on April 15, 2025, switched to bcrypt for user passwords. The details, published on the core developers' blog:

![Four-layer diagram: the password entered goes through HMAC-SHA384 pre-hashing encoded in base64 to work around the 72-byte limit, then through bcrypt with a random salt and a cost factor, and the stored hash starts with $wpy$ followed by the cost, the salt and the result](https://www.wp-masquerade.com/media/2026/10/bcrypt-wordpress-hachage-en.webp)

*The path of a password in WordPress 6.8 and later.*

- The password is first pre-hashed with HMAC-SHA384 and then base64-encoded, so that passwords longer than 72 bytes keep all their entropy.
- Hashes carry the `$wp$2y$` prefix, which sets them apart from standard bcrypt.
- Old phpass hashes are still accepted and are converted to bcrypt the next time each user logs in or changes their password.
- Application passwords, password reset keys and a few other tokens use a different function, BLAKE2b through the Sodium library; existing application passwords are not converted automatically.
- The `wp_hash_password_algorithm` filter lets you choose Argon2id if the server supports it, and `wp_hash_password_options` lets you adjust parameters such as the cost.

No action is needed on your side. Just keep in mind that rolling back to WordPress 6.7 or earlier would prevent users who have already been converted from logging in until they reset their password. Our article [on wp-config.php](https://www.wp-masquerade.com/wp-config-security-settings/) covers this change and the file's security keys.

## What bcrypt doesn't do

bcrypt protects passwords **after** a database leak: it slows down offline cracking. It does nothing against an online [brute-force attack](https://www.wp-masquerade.com/glossary/brute-force-attack/) on the login page, nor against a password that already appeared in a breach and is reused elsewhere, the basis of [credential stuffing](https://www.wp-masquerade.com/glossary/credential-stuffing/). For that, rely on unique passwords, login attempt limits and [two-factor authentication](https://www.wp-masquerade.com/glossary/two-factor-authentication/), which WP Masquerade Pro offers along with its [login attempt limiting](https://www.wp-masquerade.com/features/login-attempt-limiting/).

## Related terms

- [Password salting](https://www.wp-masquerade.com/glossary/password-salting/)
- [Brute-force attack](https://www.wp-masquerade.com/glossary/brute-force-attack/)
- [Credential stuffing](https://www.wp-masquerade.com/glossary/credential-stuffing/)
- [Two-factor authentication (2FA)](https://www.wp-masquerade.com/glossary/two-factor-authentication/)
- [Nonce](https://www.wp-masquerade.com/glossary/nonce/)


## Sources

- [Make WordPress Core : WordPress 6.8 will use bcrypt for password hashing](https://make.wordpress.org/core/2025/02/17/wordpress-6-8-will-use-bcrypt-for-password-hashing/)
- [WordPress Developer Resources : wp_hash_password()](https://developer.wordpress.org/reference/functions/wp_hash_password/)
- [OWASP : Password Storage Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html)
- [USENIX 1999 : A Future-Adaptable Password Scheme (Provos et Mazières)](https://www.usenix.org/legacy/events/usenix99/provos.html)
