April 2008 Entries
Just a quick tip.
I was unaware until recently that SQL Server 2005 has nicely built in support for hashing and it is called hashbytes
HashBytes ( '<algorithm>', { @input | 'input' } )
<algorithm>::= MD2 | MD4 | MD5 | SHA | SHA1
Parameters are the algorithm you wish to hash to and the input string to hash.
Here is a sample along with the return values commented in the next line:
Select HashBytes('MD2', 'Hello world!')
--0x63503D3117AD33F941D20F57144ECE64
Select HashBytes('MD4', 'Hello world!')
--0x0D7A9DB5A3BED4AE5738EE6D1909649C
Select HashBytes('MD5', 'Hello world!')
--0x86FB269D190D2C85F6E0468CECA42A20
Select HashBytes('SHA', 'Hello world!')
--0xD3486AE9136E7856BC42212385EA797094475802
Select HashBytes('SHA1', 'Hello world!')
--0xD3486AE9136E7856BC42212385EA797094475802
MSDN: http://msdn2.microsoft.com/en-us/library/ms174415.aspx