PHPackages                             roots/wp-password-bcrypt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. roots/wp-password-bcrypt

Abandoned → [roots/wp-password-bcrypt](/?search=roots%2Fwp-password-bcrypt)ArchivedLibrary[Security](/categories/security)

roots/wp-password-bcrypt
========================

WordPress plugin which replaces wp\_hash\_password and wp\_check\_password's phpass hasher with PHP 5.5's password\_hash and password\_verify using bcrypt.

1.3.0(1y ago)63510.1M—6%6920MITPHPPHP &gt;=8.0CI passing

Since Feb 29Pushed 1y ago49 watchersCompare

[ Source](https://github.com/roots/wp-password-bcrypt)[ Packagist](https://packagist.org/packages/roots/wp-password-bcrypt)[ Docs](https://roots.io/plugins/wp-password-bcrypt)[ GitHub Sponsors](https://github.com/roots)[ RSS](/packages/roots-wp-password-bcrypt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (9)Used By (20)

wp-password-bcrypt
==================

[](#wp-password-bcrypt)

Drop-in bcrypt password hashing for WordPress

[![Packagist](https://camo.githubusercontent.com/2a6a153348212306687e99abd81647ae4aeadd1a5b726ec44be38a484c4e6004/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6f74732f77702d70617373776f72642d6263727970742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roots/wp-password-bcrypt)

Warning

This package will become redundant with WordPress 6.8+ as bcrypt becomes the default password hashing method. See [**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/) for more details.

**Migration**: When upgrading to WordPress 6.8+, you can safely remove this package. All existing passwords will continue to work without any additional steps required.

Overview
--------

[](#overview)

wp-password-bcrypt is a WordPress plugin to replace WP's outdated and insecure MD5-based password hashing with the modern and secure [bcrypt](https://en.wikipedia.org/wiki/Bcrypt).

This plugin requires PHP &gt;= 5.5.0 which introduced the built-in [`password_hash`](http://php.net/manual/en/function.password-hash.php) and [`password_verify`](http://php.net/manual/en/function.password-verify.php) functions.

See [Improving WordPress Password Security](https://roots.io/improving-wordpress-password-security/) for more background on this plugin and the password hashing issue.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.5.0
- WordPress &gt;= 4.4 (see )

Installation
------------

[](#installation)

This plugin is a Composer library so it can be installed in a few ways:

#### Composer Autoloaded

[](#composer-autoloaded)

`composer require roots/wp-password-bcrypt`

`wp-password-bcrypt.php` file will be automatically autoloaded by Composer and it *won't* appear in your plugins.

#### Manually as a must-use plugin

[](#manually-as-a-must-use-plugin)

If you don't use Composer, you can manually copy `wp-password-bcrypt.php` into your `mu-plugins` folder.

We **do not** recommend using this as a normal (non-mu) plugin. It makes it too easy to disable or remove the plugin.

The Problem
-----------

[](#the-problem)

WordPress still uses an MD5 based password hashing scheme. They are effectively making 25% of websites more insecure because they refuse to bump their minimum PHP requirements. By continuing to allow EOL PHP versions back to 5.2, they can't use newer functions like `password_hash`.

This is a [known](https://core.trac.wordpress.org/ticket/21022) problem which WordPress has ignored for over 4 years now. Not only does WordPress set the insecure default of MD5, they don't do any of the following:

- document this issue
- provide instructions on how to fix it and make it more secure
- notify users on newer PHP versions that they *could* be more secure

What's wrong with MD5? Really simply: it's too cheap and fast to generate cryptographically secure hashes.

The Solution
------------

[](#the-solution)

WordPress did at least one good thing: they made `wp_check_password` and `wp_hash_password` [pluggable](https://codex.wordpress.org/Pluggable_Functions) functions. This means we can define these functions in a plugin and "override" the default ones.

This plugin plugs in 3 functions:

- `wp_check_password`
- `wp_hash_password`
- `wp_set_password`

#### `wp_hash_password`

[](#wp_hash_password)

This function is the simplest. This plugin simply calls `password_hash` instead of WP's default password hasher. The `wp_hash_password_options` filter is available to set the [options](http://php.net/manual/en/function.password-hash.php) that `password_hash` can accept.

#### `wp_check_password`

[](#wp_check_password)

At its core, this function just calls `password_verify` instead of the default. However, it also checks if a user's password was *previously* hashed with the old MD5-based hasher and re-hashes it with bcrypt. This means you can still install this plugin on an existing site and everything will work seamlessly.

The `check_password` filter is available just like the default WP function.

#### `wp_set_password`

[](#wp_set_password)

This function is included here verbatim but with the addition of returning the hash. The default WP function does not return anything which means you end up hashing it twice for no reason.

The `wp_set_password` action is available just like the default WP function.

FAQ
---

[](#faq)

**What happens to existing passwords when I install the plugin?**

Nothing at first. An existing password is only re-hashed with bcrypt *when they log in*. If a user never logs in, their password will remain hashed with MD5 in your database forever.

**Why doesn't this plugin re-hash all existing passwords in the database?**

Right now it's beyond the scope of the plugin. We want to keep it simple and straightforward. This is probably best left up to the individual developer or maybe a separate plugin in the future. See [\#6](https://github.com/roots/wp-password-bcrypt/issues/6) for more details.

**What happens if I remove/deactivate the plugin?**

Magically, everything still works. See this [comment](https://github.com/roots/wp-password-bcrypt/issues/7#issuecomment-190919884) for more details.

Any existing bcrypt hashed passwords will remain that way. Any new users or users resetting a password will get a new MD5 hashed password.

**Why doesn't this plugin show up in the admin?**

If you're using Composer, then the `wp-password-bcrypt.php` file is automatically autoloaded. It's not treated as a true WordPress plugin since the package type is not set to `wordpress-muplugin` so it won't show up in the plugin list.

**What's wrong with using this as a plugin instead of a must-use plugin?**

As explained above, you don't want to disable this plugin once you've enabled it. Installing this in `plugins` (as a "normal" plugin) instead of in `mu-plugins` (as a must-use plugin) makes it possible for an admin user to accidentally disable it.

**How is this different than other plugins which already exist?**

There are a [few plugins](https://en-gb.wordpress.org/plugins/search.php?q=bcrypt) that exist which enable bcrypt. This plugin is different because we bypass the `PasswordHash` class and the `phpass` library that WordPress core uses. This plugin uses PHP's built-in `password_hash` and `password_verify` functions directly to only support PHP 5.5+.

**I already use Two-factor authentication and/or prevent brute-force login attempts. Does this plugin still help?**

Better hashing functions like bcrypt serve a different purpose than Two-factor authentication, brute-force attempt protection, or anything which acts at the log in stage. Strong hashing functions are important if an attacker is able to get access to your database. They will make it much harder/practically impossible to determine the plain-text passwords from the hashes. Whereas with MD5, this is trivial. Tools/plugins to protect logging in are still important and should be used together with this plugin.

Further Reading
---------------

[](#further-reading)

- `password_hash` [RFC](https://wiki.php.net/rfc/password_hash)
- [Secure Password Storage in PHP](https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016#php)
- [How To Safely Store A Password](https://codahale.com/how-to-safely-store-a-password/)

Contributors
------------

[](#contributors)

This plugin is based on a [Gist](https://gist.github.com/Einkoro/11078301) by [@Einkoro](https://github.com/Einkoro).

It has been modified and packaged by the Roots team. Jan Pingel (@Einkoro) has granted his permission for us to redistribute his original BSD-licensed code to an MIT license.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance47

Moderate activity, may be stable

Popularity67

Solid adoption and visibility

Community45

Growing community involvement

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~833 days

Total

5

Last Release

396d ago

Major Versions

0.1.0 → 1.0.02016-03-01

PHP version history (3 changes)0.1.0PHP &gt;=5.5.0

1.1.0PHP &gt;=5.6.0

1.3.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f6a3f6809aec26ab615cf9c5ae69c37d5068c8613e77a3aad4e97bad98d0fb3?d=identicon)[swalkinshaw](/maintainers/swalkinshaw)

![](https://www.gravatar.com/avatar/f3f71fa88954b93f55af5e121f1d8c38d240a0d17712c092a389bcccffa34415?d=identicon)[retlehs](/maintainers/retlehs)

---

Top Contributors

[![swalkinshaw](https://avatars.githubusercontent.com/u/295605?v=4)](https://github.com/swalkinshaw "swalkinshaw (45 commits)")[![retlehs](https://avatars.githubusercontent.com/u/115911?v=4)](https://github.com/retlehs "retlehs (8 commits)")[![QWp6t](https://avatars.githubusercontent.com/u/2104321?v=4)](https://github.com/QWp6t "QWp6t (5 commits)")[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (5 commits)")[![johnbillion](https://avatars.githubusercontent.com/u/208434?v=4)](https://github.com/johnbillion "johnbillion (5 commits)")[![paultibbetts](https://avatars.githubusercontent.com/u/2053583?v=4)](https://github.com/paultibbetts "paultibbetts (1 commits)")[![mckernanin](https://avatars.githubusercontent.com/u/6300047?v=4)](https://github.com/mckernanin "mckernanin (1 commits)")[![michaelbeil](https://avatars.githubusercontent.com/u/4752949?v=4)](https://github.com/michaelbeil "michaelbeil (1 commits)")[![dr5hn](https://avatars.githubusercontent.com/u/6929121?v=4)](https://github.com/dr5hn "dr5hn (1 commits)")

---

Tags

bcryptwordpresswordpress-pluginwordpresspasswordsbcrypt

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/roots-wp-password-bcrypt/health.svg)

```
[![Health](https://phpackages.com/badges/roots-wp-password-bcrypt/health.svg)](https://phpackages.com/packages/roots-wp-password-bcrypt)
```

###  Alternatives

[jeremykendall/password-validator

Password Validator validates password\_hash generated passwords, rehashes passwords as necessary, and will upgrade legacy passwords.

14469.9k3](/packages/jeremykendall-password-validator)[elnur/blowfish-password-encoder-bundle

Blowfish (bcrypt) based password encoder for Symfony2

61129.6k](/packages/elnur-blowfish-password-encoder-bundle)[brain/nonces

OOP package for WordPress to deal with nonces.

26227.1k1](/packages/brain-nonces)[ammardev/laravel-wp-hash-driver

Supports Wordpress passwords hashing and checking in Laravel's Hash facade.

169.3k](/packages/ammardev-laravel-wp-hash-driver)[defuse/php-passgen

PHP Random Password Generator Library

4017.7k](/packages/defuse-php-passgen)[paragonie/passwdqc

Password/passphrase strength checking and enforcement

3815.1k1](/packages/paragonie-passwdqc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
