Reducing rails asset pipeline's 64 bytes of digest size

After upgrading recent version of sprockets gem in my Rails application, generated asset digest size increased to 64 bytes instead of 32.

Digest hash calculation algorithm also changed to Digest::SHA256 which is %70 slower than Digest::MD5

Is it possible to switch 32 bytes of digest mode as before?

It seems that sprocket’s developers doesn’t want to change this behaviour.

On the other hand, I agree with you. MD5 digests enough for asset pipelines. MD5 hash calculations quite fast and it is nearly impossible to get same hash value for the same asset with additional benefit of smaller digest size.

You can use MD5 digest with the following change on config/environments/production.rb:

config.assets.configure do |env|
  env.digest_class = Digest::MD5

After that you can compile assets:

rake assets:precompile RAILS_ENV=production