summaryrefslogtreecommitdiff
path: root/app/models/concerns/checksummable.rb
blob: 056abafd0ce074255c6bb99244e1fa8105f48236 (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

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

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