# Reducing rails asset pipeline's 64 bytes of digest size

**URL:** <https://linux-tips.com/t/reducing-rails-asset-pipelines-64-bytes-of-digest-size/283>\
**Category:** Programming\
**Created:** [September 29, 2015, 8:14pm UTC](https://linux-tips.com/t/reducing-rails-asset-pipelines-64-bytes-of-digest-size/283 "2015-09-29T20:14:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debuser](https://linux-tips.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@Debuser](https://linux-tips.com/u/Debuser)\
**Post date:** [September 29, 2015, 8:14pm UTC](https://linux-tips.com/t/reducing-rails-asset-pipelines-64-bytes-of-digest-size/283/1 "2015-09-29T20:14:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![DrSlump](https://linux-tips.com/user_avatar/linux-tips.com/drslump/32/61_2.png) [@DrSlump](https://linux-tips.com/u/DrSlump)\
**Post date:** [September 29, 2015, 8:34pm UTC](https://linux-tips.com/t/reducing-rails-asset-pipelines-64-bytes-of-digest-size/283/2 "2015-09-29T20:34:12Z")

</div>

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`:

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

```

After that you can compile assets:

```
rake assets:precompile RAILS_ENV=production
```
