plataformatec/devise — pull request #2361 by steakknife (2013-04-01 18:33:22+00:00)
Title: Simply SCrypt

For a relatively young project, do this

1. Add these to your Gemfile
```text
gem 'devise', :git => 'https://github.com/steakknife/devise.git'
gem 'scrypt'
```
2. Don't use `devise-encryptable`
3. Remove `:encryptable` from the User model
4. Set `config.encryptor = :scrypt` in config/initializers/devise.rb
5. Optionally set SCrypt settings in config/initializers/scrypt.rb
```ruby
require 'scrypt'

SCrypt::Engine::DEFAULTS[:key_len] = 128
SCrypt::Engine::DEFAULTS[:salt_size] = 32
SCrypt::Engine::DEFAULTS[:max_mem] = 4*1024*1024
SCrypt::Engine::DEFAULTS[:max_time] = 0.4
SCrypt::Engine::DEFAULTS[:max_memfrac] = 0.3
```
6a. Create a new migration `rails g migration DeviseScryptPasswordLength`

6b. Drop this into your project's migrations:
```ruby
# db/migrate/20130331100000_devise_scrypt_password_length.rb
class DeviseScryptPasswordLength < ActiveRecord::Migration
def up
change_column :users, :encrypted_password, :text
end
def down
change_column :users, :encrypted_password, :string
end
end
```

Note: This does not convert passwords using Bcrypt or anything else. It's only for projects without any existing users.