Sha256: d1242b65c6bc811b3106e725a2a3e772f0045e325c461b8908f625a541b1c95d

Contents?: true

Size: 446 Bytes

Versions: 2

Compression:

Stored size: 446 Bytes

Contents

# -*- coding: utf-8 -*-
#
# calculate md5 of big files, snipped found on usenet
#

if RUBY_VERSION =~ /1\.8/
  # std lib
  require 'md5'
else
  # std lib
  require 'digest/md5'
  include Digest
end

# Return an MD5 object
# example:
# MD5.file( filename ).hexdigest
#
class MD5
  def self.file(file)
    File.open(file, "rb") do |f|
      res = self.new
      while (data = f.read(4096))
        res << data
      end
      res
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tree.rb-0.3.4 lib/tree_rb/extension_md5.rb
tree.rb-0.3.3 lib/tree_rb/extension_md5.rb