MD5 digests of very big files
Jan Schenkel
janschenkel at yahoo.com
Mon Jun 28 00:34:17 EDT 2010
--- On Sun, 6/27/10, Alejandro Tejada <capellan2000 at gmail.com> wrote:
>
> Hi Jacke,
>
> Jacqueline Landman Gay wrote:
>
> > Try: if it is empty
>
> Many Thanks!
> This works. :-D
>
> Now the function will be:
>
> function quasiMD5 pFile
> local tMD5s
> open file pFile for binary read
> repeat
> read from file pFile for 4096 chars
> if it is empty then
> exit repeat
> end if
> put the md5digest of it after tMD5s
> end repeat
> close file pFile
> return the md5Digest of tMD5s
> end quasiMD5
>
>
To make this future-proof, you might want to use the byte chunk type for reading from the binary file:
read from file pFile for 4096 bytes -- was: chars
That way, after Unicode support in the revEngine becomes pervasive and transparent, the above will work just fine, whether or not the intricacies of what constitutes a 'char' change.
Jan Schenkel
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
More information about the use-livecode
mailing list