realbasic-betas.mbox
[Top] [All Lists]

Re: MD5?

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: MD5?
From: Lars Jensen <ljensen at attbi dot com>
Date: Thu, 24 Oct 2002 11:01:39 -0400
I wrote:

>>> So, would all agree that the following are sensible uses of the MD5
>>> function?
>>> 
>>> - checksum a file to see if it has changed
>>> 
>>> - quick check to see if two files have the same content
> 
> Yeah, especially if it was a folderItem call.

Mars wrote:

> Function MD5( foo As FolderItem ) As String
> Dim in As BinaryStream
> Dim digest As MD5Digest
> digest = New MD5Digest
> in = foo.OpenAsBinary( false )
> While Not in.EOF
> digest.Process in.Read( kArbitraryBlockSize )
> Wend
> Return digest.Value
> End Function
> 
> caveat: written from memory, doesn't handle common error conditions,
> probably won't compile...

Cavets like those are why I suggest that it be a call.

Noah wrote:

> No, that would make it a slow check, because first it would have to MD5
> both files completely and then compare the results (I'm assuming the MD5
> algorithm is slower than the = operator). If you want to make it a quick
> way, you have to MD5 the file yourself and save the result into the file,
> then read only that part back when comparing files.

That's that I'm suggesting: "MD5 the file" as a folderItem call.
Whether/where to store it is too dependent on circumstances to be easily
function-ized.

lj


---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>

Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.


<Prev in Thread] Current Thread [Next in Thread>