1# frozen_string_literal: true 2 3module Checksummable 4 extend ActiveSupport::Concern 5 6 class_methods do 7 def crc32(data) 8 Zlib.crc32(data) 9 end 10 11 def sha256_hexdigest(path) 12 ::Digest::SHA256.file(path).hexdigest 13 end 14 15 def md5_hexdigest(path) 16 ::Digest::MD5.file(path).hexdigest 17 end 18 end 19end 20