From: Erik Veenstra Date: 2006-03-20T04:23:49+09:00 Subject: Re: safe way to calc md5 on very large files > Why we have no such method in the digest library? I extended the MD5 class with a class method to build an MD5 object directly from the contents of a given file. Use it like this: md5 = MD5.file("foo.bar") gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- require "md5" 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 ----------------------------------------------------------------