debian-mirror-gitlab/app/models/concerns/checksummable.rb
2021-11-18 22:05:49 +05:30

19 lines
327 B
Ruby

# frozen_string_literal: true
module Checksummable
extend ActiveSupport::Concern
class_methods do
def crc32(data)
Zlib.crc32(data)
end
def sha256_hexdigest(path)
::Digest::SHA256.file(path).hexdigest
end
def md5_hexdigest(path)
::Digest::MD5.file(path).hexdigest
end
end
end