2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Checksummable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
def crc32(data)
|
|
|
|
Zlib.crc32(data)
|
|
|
|
end
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
class_methods do
|
|
|
|
def hexdigest(path)
|
2020-11-24 15:15:51 +05:30
|
|
|
::Digest::SHA256.file(path).hexdigest
|
2019-12-21 20:55:43 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|