Take a look at this thread
http://www.tek-tips.com/viewthread.cfm?qid=1268144In SQL Server you can use HashBytes function directly.
>Hi
>
>I need to calculate the MD5 on SQL Server 2005 32-bits (no way for us to upgrade to 64-bits). I do it in a VB.Net method with which I have created an assembly in SQL server (so that I can use my method like a SQL UDF).
>
>It works great for small data but when I have a large object, I get one of those error:
>
>Msg 6535, Level 16, State 49, Line 1
>.NET Framework execution was aborted. Another query caused the AppDomain DB_icISDev.dbo[runtime].101 to be unloaded or an unhandled .NET exception happened.
>System.Threading.ThreadAbortException: Thread was being aborted.
>System.Threading.ThreadAbortException:
> at SqlServerProject1.UserDefinedFunctions.TestComputeMD5FromID(Int32 pID)
>
>or
>
>Msg 6532, Level 16, State 49, Line 1
>.NET Framework execution was aborted by escalation policy because of out of memory.
>System.Threading.ThreadAbortException: Thread was being aborted.
>System.Threading.ThreadAbortException:
> at System.Data.SqlTypes.SqlBytes.get_Value()
> at System.Data.SqlServer.Internal.XvarBlobStream.GetByteArray()
> at System.Data.SqlServer.Internal.XvarBlobStream.GetSqlBinary()
>
>
>Any solutions/workaround?
>
>BTW, the same mehtod works correctly and with the same large object when not called from SQL Server.
If it's not broken, fix it until it is.
My Blog