Class: MD5

Inherits:
Object
  • Object
show all
Defined in:
lib/tree_rb/extension_digest.rb

Overview

Return an MD5 object example: MD5.file( filename ).hexdigest

Class Method Summary collapse

Class Method Details

.file(file) ⇒ Object

calculate md5 of big files, snipped found on usenet



19
20
21
22
23
24
25
26
27
# File 'lib/tree_rb/extension_digest.rb', line 19

def self.file(file)
  File.open(file, "rb") do |f|
    digest = self.new
    while (data = f.read(4096))
      digest << data
    end
    digest
  end
end