Need a way to load large files to compute MD5
Posted: Tue Sep 04, 2012 7:32 am
Hi all,
I am trying to compute MD5 checksum for large files. Anywhere from 2gig to 45gig. They are video files. Is there a way to compute the MD5 without the need to load a file into memory? When I try Livecode will crash, understandable as I am trying to load a 45gig file into memory when the PC only has 16gig!
The above example I created for quick testing, taken code from various examples on the Livecode website.
Kind Regards,
Scott
I am trying to compute MD5 checksum for large files. Anywhere from 2gig to 45gig. They are video files. Is there a way to compute the MD5 without the need to load a file into memory? When I try Livecode will crash, understandable as I am trying to load a 45gig file into memory when the PC only has 16gig!
Code: Select all
global tData
on LoadFile
answer file "Please select a file"
if it is empty then
exit to top
end if
put it into theFilePath
open file theFilepath for binary read
read from file theFilePath until end
put it into theBinaryData
close file theFilePath
put hexDigest(theBinaryData) into field "fText"
end LoadFile
function hexDigest pvalue
local tRes
put md5Digest(pValue) into tMD5
get binaryDecode("H*",tMD5,tRes)
return tRes
end hexDigest
Kind Regards,
Scott