 |
|
 |
It looks like what you want to do is check if the two hashes are equal. Try this function:
Private Function AreHashesEqual(ByVal hash1 As Byte(), ByVal hash2 As Byte()) As Boolean
If hash1.Length = hash2.Length Then
Dim i As Integer = 0
While ((i < hash2.Length) AndAlso (hash2(i) = hash1(i)))
i += 1
End While
If (i = hash2.Length) Then
Return True
End If
End If
Return False
End Function
|
|
|
|
 |
|
 |
Thanks for this reply, but my problem is that in SQL, dbo.fn_md5x is giving me a hash that is totally different from what I get in VB.NET via System.Security.Cryptography.MD5CryptoServiceProvider
|
|
|
|
 |
|
 |
It is a pain but I have managed to compile a 64 bit version of the dll.
--
David
|
|
|
|
 |
|
 |
To the Author...Is there any license, restriction of use or fee for using this code/dll? Is it available for free use by companies?
Please advise...
Thank You!
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
hello
i hv a field having comma saparated int values n i want to find d count of particular value in d table
example :
jobtypes
------------
1,2,3,4,
2,7,9,
1,4,6,7,
n i want to find count of 1
expected answer=2;
plz help
|
|
|
|
 |
|
 |
You have posted the question in the wrong area...
but since you ask,try this:
SELECT COUNT(n) FROM d WHERE n like '%1,%'
|
|
|
|
 |
|
 |
SQL server supports an function for MD5 encryption, why not just use that
HashBytes( <algorithm>, <input> )
algorithm = 'MD2' | 'MD4' | 'MD5' | 'SHA' | 'SHA1'
input types = varchar | nvarchar | varbinary
0xA5BA0D8F38FB421F472CCE3C566467A7 = SELECT HashBytes('MD2','CodeProject.com')
0xBEC58CDEEB04C7B366E4FDD4F35D4603 = SELECT HashBytes('MD4','CodeProject.com')
0x1BA4C8D9E8F1B1DD8BC05379ED3292EB = SELECT HashBytes('MD5','CodeProject.com')
0x0EF9E6456730DBAD24BFE4FEC6DB85032EB0DBB0 = SELECT HashBytes('SHA','CodeProject.com')
0x0EF9E6456730DBAD24BFE4FEC6DB85032EB0DBB0 = SELECT HashBytes('SHA1','CodeProject.com')
Or
INSERT INTO Users(Username,Password) VALUES('Administrator', HashBytes('SHA1','P@55w0rd'))
Or
Look here at Microsoft http://msdn2.microsoft.com/en-us/library/ms174415.aspx[^]
|
|
|
|
 |
|
 |
That works WONDERFULLY in 2005; however, it is not available in 2000. Please read the link you provided.
|
|
|
|
 |
|
 |
Well, Convert your system to SQL 2005 or use the lighter version of hashing on the SQL 2000 server called pwdencrypt
I think i know what i linked to, so i wont use my time to read it again.
But the fact is you can encrypt on a SQL 2000 server, the function although, is hidden and called pwdencrypt and it has its weakness but google it and find some info on it http://www.google.com/search?q=pwdencrypt[^]
|
|
|
|
 |
|
 |
How do I pass a SecureString var. to SQLS Stored Procedure?
Both from C#, and SQL Server side?
I'm assuming varbinary on the SS side, will handle
this as Input parameter to stored procedure.
I'm just not sure of the allowable code to handle this.
F.Z. Atlanta
|
|
|
|
 |
|
 |
like some guy told earlier, there are some collision problems with md5 and it is recommended to use a salt for passwords -its no big deal for cheksums. is it possible to use salt with this code??
|
|
|
|
 |
|
 |
Hi Vic Mackey,
you call the srv_paraminfo two times
srv_paraminfo(pSrvProc, 1, &cType, &uMaxLen, &uLen, NULL, &fNull);
pData = (BYTE*)malloc(uLen);
srv_paraminfo(pSrvProc, 1, &cType, &uMaxLen, &uLen, pData, &fNull); :confused:
uDataLen = uLen;
it make no sence for me, because all the same param.
Regards Marc
|
|
|
|
 |
|
 |
Hmm,
sry it is my fault. I haven't seen the differnce. But it become clear. I have seen the pData for the buffer param.
So it is clear now...
Thanks Marc
|
|
|
|
 |
|
 |
Has anyone tested this in SQL 2005 yet? Or have a variant that works in 2005?
|
|
|
|
 |
|
 |
Hi,
I think in SQL2005, you have a function which gives you back a md5, so you didn't need this.
Regards
Marc
|
|
|
|
 |
|
 |
The SQL 2005 function is HashBytes
|
|
|
|
 |
|
 |
Downloaded it, compiled it, used it.
And I learned some stuff by reading the source code
Thanks!
|
|
|
|
 |
|
 |
yup..this is the good one...thx..
|
|
|
|
 |
|
 |
Hello,
I am a bit surprised that there is more then just one result after a md5 hash. RFC 1321 describes a 128 bit output after application of their algorithm. What is different in your code? The reference (link to the algorithm) is not available anymore.
So, I am sure that this is definitely an encription function but is it MD5?
Martin
|
|
|
|
 |
|
 |
128 bits is 16 bytes, but those are in binary.
This outputs that 16 bit binary string in hexadecimal, which gives 32 bytes.
Yes, this is MD5.
|
|
|
|
 |
|
 |
Hello guys, i need ur help...
I have one table with much rows, one row is, passwords...(pass of 800 users) and i like update my DB to MD5. The row passwords of 800 users to MD5 encription.
Please need SQL script to convert the row passwords (with the data pass of 800 users) to MD5...
Somebody help me?
Sorry my english and thanks all
|
|
|
|
 |
|
 |
select a , b , c , dbo.fn_md5(c) as EncPassword from table_a
or
update table_a set c = dbo.fn_md5(c)
|
|
|
|
 |
|
 |
Hi,
I'm using the MD5 dll on SQL 2000 servers and it works perfect. However, recently I got the need to use it on a win2003 server and SQL 2005 server, both 64-bit versions. It does not work...
I did like before:
USE master;
EXEC sp_addextendedproc 'xp_md5', 'xp_md5.dll'
no complaints here.
But when I try this:
EXEC master.dbo.xp_md5 'Hello world!'
I get the following error:
Msg 17750, Level 16, State 0, Procedure xp_md5, Line 1
Could not load the DLL xp_md5.dll, or one of the DLLs it references. Reason: 193(%1 is not a valid Win32 application.).
Which confuses me.. Is this because some missing error messages for the x64 version? Or does it mean that I'm toast? I think I am toast and that I need a 64-bit version.
Any suggestions?
KP
|
|
|
|
 |