From: Carl Youngblood Date: 2003-12-23T05:56:53+09:00 Subject: Re: md5 Speaking of which, where can I find documentation for the Digest class? I can't find it in ruby-doc.org, and there is very little in digest.rb class to explain how it works. Thanks, Carl Youngblood messju mohr wrote: > On Tue, Dec 23, 2003 at 02:21:40AM +0900, KONTRA Gergely wrote: > >>Hi! >> >>Is there any efficient way to calculate the md5 hash for a file? >> >>Reading the entire file isn't memory efficient under winxp (big file...) ;( > > > require 'md5' > > d = Digest::MD5.new > chunk = nil > md5 = nil > begin > while (chunk = STDIN.sysread(4096)) do > d.update(chunk) > end > rescue EOFError > md5 = d.to_s > end > print md5 + "\n" > > > >>Gergo > > >