Same file?

Richard Gaskin ambassador at fourthworld.com
Fri Apr 16 20:50:03 EDT 2010


Paul D. DeRocco wrote:

>> From: Richard Gaskin
>>
>> Andre wrote:
>>
>> > put the md5digest of url ("binfile:" & path1) into tMD5file1
>> > put the md5digest of url ("binfile:" & path2) into tMD5file2
>> > if tMD5file1 is tMD5file2 then
>> >   return true
>> > else
>> >   return false
>> > end if
>>
>> Andre, you've been programming too deeply for too long. :)
>>
>> MD5digest is great for storing small signatures of large files, but
>> since the function reads the full file contents it can simply use:
>>
>>    if url ("binfile:"& path1) is url ("binfile:"& path2) then
>>    ...
>
> I expect that loads both files into RAM in their entirety before comparing
> them, while computing a digest of each doesn't.

There may be ways to compute a digest without reading the file into 
memory in other systems, but IIRC Rev's md5digest function only works on 
data, not file specs.

Also, to the engine this:

   put the md5digest of url ("binfile:" & path1) into tMD5file1

Looks like:

   put url ("binfile:" & path1) into someUnspecifiedContainer
   put md5Digest(someUnspecifiedContainer) into tMD5file1


Rev's insistence that it calculates the digest from contents in memory 
is the subject of an RQCC request:
<http://quality.runrev.com/qacenter/show_bug.cgi?id=2410>

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list