added some optimization to compare the files by size first before calculating the digest