hash vs. MSSQL MD5

220 views
Skip to first unread message

Michael Hnat

unread,
Feb 10, 2011, 12:01:49 PM2/10/11
to ra...@googlegroups.com

Hi,

 

I’m trying to compare two values by using a MD5 hash.

 

In Railo I just use hash(email,‘MD5‘) and get „4288C64CD30107E8A115D0BED0D84DDF“

 

In MSSQL I’m using the following code(inspired by Paul Kukiel) (http://blog.kukiel.net/2009/11/coldfusion-md5-hash-directy-in-mssql.html)

 

SELECT upper(right(master.dbo.fn_varbintohexstr(HashBytes('MD5', email)), 32)) as email

 

The result here is „93AB37E0A898A07DDEF410C7D8E4813A“

 

So they never match.

 

 

Who’s right?

 

Any idea what is wrong here?

 

 

Cheers,

Michi

 

 

PS: Railo 3.2, MSSQL 10.0.4000

 

Richard Joo

unread,
Feb 10, 2011, 12:09:34 PM2/10/11
to ra...@googlegroups.com
We had the same issue with Railo under Linux.
We are in the middle of moving our sites from adobe CF to Railo.

What we did was we used LCASE(email) on Railo side and was able to make this work from both Adobe CF and Railo.


--
Richard Joo
Director of Innovation
Telelanguage, Inc.

Andrew Penhorwood

unread,
Feb 10, 2011, 1:01:56 PM2/10/11
to ra...@googlegroups.com
You will need to concern yourself with character set, case and anything else that could case the data to be different between the SQL server and Railo.  I had a problem when doing hashes between my dev box and my production box.  One runs Windows and one runs Gentoo Linux.  The file line encoding are different which causes the hash to change.

Andrew Penhorwood

Michael Hnat

unread,
Feb 10, 2011, 3:50:36 PM2/10/11
to ra...@googlegroups.com

Looks like a character set problem. Thanks for the hint.

 

Michi

Paul Kukiel

unread,
Feb 10, 2011, 7:38:03 PM2/10/11
to ra...@googlegroups.com
Did that work? 

I know when I did that post and was using that the database was case insensitive also that project was AFC not Railo.

Regards,

Paul
Reply all
Reply to author
Forward
0 new messages