summaryrefslogtreecommitdiff
path: root/app/models/concerns/checksummable.rb
blob: d6d17bfc604d57bc15a50540820d841cabcef0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Checksummable
  extend ActiveSupport::Concern

  def crc32(data)
    Zlib.crc32(data)
  end

  class_methods do
    def hexdigest(path)
      ::Digest::SHA256.file(path).hexdigest
    end
  end
end