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.34.0 lib/utils/md5.rb
utils-0.33.1 lib/utils/md5.rb
utils-0.33.0 lib/utils/md5.rb
utils-0.32.0 lib/utils/md5.rb
utils-0.31.1 lib/utils/md5.rb
utils-0.31.0 lib/utils/md5.rb
utils-0.30.2 lib/utils/md5.rb
utils-0.30.1 lib/utils/md5.rb
utils-0.30.0 lib/utils/md5.rb
utils-0.29.0 lib/utils/md5.rb
utils-0.28.0 lib/utils/md5.rb
utils-0.27.0 lib/utils/md5.rb
utils-0.26.1 lib/utils/md5.rb
utils-0.26.0 lib/utils/md5.rb
utils-0.25.0 lib/utils/md5.rb
utils-0.24.2 lib/utils/md5.rb
utils-0.24.1 lib/utils/md5.rb
utils-0.24.0 lib/utils/md5.rb
utils-0.23.3 lib/utils/md5.rb
utils-0.23.1 lib/utils/md5.rb