debian-mirror-gitlab/app/models/concerns/checksummable.rb

16 lines
242 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
module Checksummable
extend ActiveSupport::Concern
class_methods do
2021-01-03 14:25:43 +05:30
def crc32(data)
Zlib.crc32(data)
end
2019-12-21 20:55:43 +05:30
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