lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sun, Nov 07, 2010 at 10:44:56PM +0100, Marcin Jurczuk wrote:
> > return fh and md5.sumhexa(,"rb"):read(10485760)) or nil
> Try using read("*a").
> This will read whole file - a those files have > 500MB usually.
> I need only first 10MB to calculate checksum..

Not interested in corruption or attack on the rest of the file?

The solution here, of course, is to hash a chunk of the file, and then
skip some of the file using a decision based on the output of the
previous hash.