Chris,

You could use the availabled method in a loop condition as well.

One thing I noticed is that you cannot loop over a byte array in openbd. Things 
like arrayLen work, but cannot get an array element using myByteArr[1] syntax 
is where it fails. I'll file a ticket later.

.Pjf
-----Original Message-----
From: "[email protected]" <[email protected]>
Date: Sun, 8 Nov 2009 08:13:50 
To: Open BlueDragon<[email protected]>
Subject: [OpenBD] Re: MD5 Hash of uploaded cffile


read my mind,  I think you can avoid reading the whole file into
memory by using a DigestInputStream

<cfscript>
fis = createobject("java", "java.io.FileInputStream").init("/path/to/
your/file");
md = createobject("java", "java.security.MessageDigest").getInstance
("MD5");
dis = createobject("java", "java.security.DigestInputStream").init
(fis, md);
while (dis.read() != -1);
dis.close();
md5hash = binaryEncode(dis.getMessageDigest().digest(), "hex");
</cfscript>

** only tested this on CF9, that while() clause might blow up on
openbd, but you get the idea

Chris

On Nov 8, 3:57 pm, Alan Williamson <[email protected]> wrote:
> How about I add:
>
>    HashBinary( binaryObject or filePathName )
>
> That way, you don't have to take the hit of read the whole file into
> memory if you just want the MD5 of a file on the file system?


--~--~---------~--~----~------------~-------~--~----~
Open BlueDragon Public Mailing List
 http://groups.google.com/group/openbd?hl=en
 official site @ http://www.openbluedragon.org/

!! save a network - trim replies before posting !!
-~----------~----~----~----~------~----~------~--~---

Reply via email to