2019-10-08 20:06:06 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Checksummable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
2020-09-28 11:09:44 -04:00
|
|
|
def crc32(data)
|
|
|
|
Zlib.crc32(data)
|
|
|
|
end
|
|
|
|
|
2019-10-08 20:06:06 -04:00
|
|
|
def hexdigest(path)
|
2020-08-27 20:10:34 -04:00
|
|
|
::Digest::SHA256.file(path).hexdigest
|
2019-10-08 20:06:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|