Sha256: dc95294b84fdb2d4f08e0c5284a242e34a846d5dcbb690c7884c62fa19ce44c5

Contents?: true

Size: 403 Bytes

Versions: 157

Compression:

Stored size: 403 Bytes

Contents

require 'digest/md5'

module Utils
  module MD5
    class << self
      attr_accessor :buffer_size
    end
    self.buffer_size = 2 ** 20 - 1

    module_function

    def md5(filename)
      digest = Digest::MD5.new
      digest.reset
      File.open(filename, 'rb') do |f|
        until f.eof?
          digest << f.read(MD5.buffer_size)
        end
      end
      digest.hexdigest
    end
  end
end

Version data entries

157 entries across 157 versions & 1 rubygems

Version Path
utils-0.62.0 lib/utils/md5.rb
utils-0.61.0 lib/utils/md5.rb
utils-0.60.2 lib/utils/md5.rb
utils-0.60.1 lib/utils/md5.rb
utils-0.60.0 lib/utils/md5.rb
utils-0.59.2 lib/utils/md5.rb
utils-0.59.1 lib/utils/md5.rb
utils-0.59.0 lib/utils/md5.rb
utils-0.58.0 lib/utils/md5.rb
utils-0.57.1 lib/utils/md5.rb
utils-0.57.0 lib/utils/md5.rb
utils-0.56.1 lib/utils/md5.rb
utils-0.56.0 lib/utils/md5.rb
utils-0.55.0 lib/utils/md5.rb
utils-0.54.1 lib/utils/md5.rb
utils-0.54.0 lib/utils/md5.rb
utils-0.53.1 lib/utils/md5.rb
utils-0.53.0 lib/utils/md5.rb
utils-0.52.1 lib/utils/md5.rb
utils-0.52.0 lib/utils/md5.rb