Strange, I get two completely different values.

cf:
<cfset theFile = #ExpandPath("./files/SpryAssets.zip")#>
<cffile action="read" file='#theFile#' variable="xFile" />
<cfdump var="#hash(xFile)#">

result = 2BB4CCC9F80ABD2D257C194CFD184771


local$ openssl md5 SpryAssets.zip
MD5(SpryAssets.zip)= 51d9e575628fa0a78d3712cfc7dfc5b0

thanks,
tom



On Nov 7, 2:35 pm, Matthew Woodward <[email protected]> wrote:
> Tom Jones wrote:
> > Is there a plugin or something that will allow me to get the MD5 or  
> > SHA1 hash of a file that has just been uploaded? I was trying to use  
> > "hash()" but when I try to verify it with "openssl MD5 fileName" it's  
> > a totally different value.
>
> The hash() function defaults to use MD5 so I'm not sure why you'd be
> getting different values from openssl. I just tested things and I don't
> get different values from openssl.
>
> To test, I created a test.txt file containing "This is a test of the MD5
> hash". I then ran the following code on OpenBD:
> <cffile action="read" file="#ExpandPath('test.txt')#" variable="foo" />
> <cfset fooHash = Hash(foo) />
> <cfoutput>#fooHash#</cfoutput>
>
> This output:
> 31C30AF062B9CEF1647ECB4A2CB1F9DA
>
> I then checked using Linux's md5sum command against test.txt, which output:
> 31c30af062b9cef1647ecb4a2cb1f9da  test.txt
>
> I then checked using openssl md5 test.txt which output:
> MD5(test.txt)= 31c30af062b9cef1647ecb4a2cb1f9da
>
> So at least in my testing, other than the output from OpenBD being all
> upper case, the MD5 values are the same.
>
> Are you sure there isn't something else in the mix throwing things off?
> Do you have code you can share?
>
> --
> Matthew Woodward
> [email protected]http://mpwoodward.posterous.com
> identi.ca/Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint, etc. 
> as attachments.http://www.gnu.org/philosophy/no-word-attachments.html

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