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 !!
-~----------~----~----~----~------~----~------~--~---