0.0
The project is in a healthy, maintained state
Allows Devise passwords to be re-encrypted with various hashing strategies and configurations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 2.3
>= 4.0, < 6.0
 Project Readme

Devise::Hashable

Gem Version Downloads CI RuboCop Sponsor

Modern password hashing for Devise, with no forced password reset.

Devise stores passwords with bcrypt. This gem adds PBKDF2 and Argon2id, and migrates your existing users onto them one at a time, as each signs in. Nobody is locked out, nothing is reset, and you can change your mind and move back.

Requires Ruby 3.3 or newer. Tested against Rails 7.1, 7.2, 8.0 and 8.1, on Devise 4.9 and 5.0.

Installation

bundle add devise-hashable

Usage

Add :password_hashable to your Devise model and name a strategy:

class User < ApplicationRecord
  devise :database_authenticatable, :registerable
  devise :password_hashable, hashing_strategy: :argon2
end

That is the whole setup. The next time each user signs in, their password is verified against its existing hash and then re-hashed with Argon2id.

If you would rather confirm the wiring before anything changes, start by naming the scheme you already use. Nothing will be re-hashed:

devise :password_hashable, hashing_strategy: :bcrypt

Strategies

Strategy Choose it when
Argon2id You are free to pick on security grounds. Memory-hard, RFC 9106
PBKDF2 You need a FIPS-aligned KDF
Bcrypt You want Devise's existing behaviour, unchanged

Documentation

Development

After checking out the repo, run bin/setup to install dependencies. Then run rake test to run the tests, or bin/console for an interactive prompt.

The suite is written in Minitest, deliberately, so that public Devise modules can be imported and plugged straight into it. It is held at 100% line and branch coverage — raise the floors in test/test_helper.rb when coverage improves, never lower one to make a run pass.

bundle exec appraisal install sets up the Rails and Devise combinations that CI runs; bundle exec appraisal rake test runs the whole matrix locally.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/MatthewKennedy/devise-hashable/issues.

Sponsoring

devise-hashable is free to use under the MIT licence, and maintained in spare time. If it saves you some, you can sponsor its development.

Sponsorship buys no support commitment and no influence over what gets built — bug reports and pull requests are as welcome from everyone as they always were.

License

The gem is available as open source under the terms of the MIT License.