> return fh and md5.sumhexa(io.open(fname,"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..