MD5 Hash and store to SQL

I am looking for an easy to use MD5 hashing function. Then I need to know what datatype to make the field in the DB that I am saving this value to.

I do NOT want Encryption because I want the value to be irreversible. This is for passwords to an admin section and I don't want people seeing the passwords if they look at the data in the DB.

Lastly, it's not necessary, but if there is also a way to perform the function about in SQL so I can write a quick update script w/o going through my code, that would be great!
LVL 28
strickddAsked:
Who is Participating?
 
DhaestConnect With a Mentor Commented:
HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string)
http://bloggingabout.net/blogs/rick/archive/2005/05/18/4118.aspx

Symmetric Cryptography and Hashing in C#
http://www.codeproject.com/csharp/chidi_cryptommetric.asp

Another encryption: rijndael
Simple encrypting and decrypting data in C#
0
 
DhaestCommented:
MD5 Hash SQL Server Extended Stored Procedure
http://www.codeproject.com/database/xp_md5.asp
0
 
strickddAuthor Commented:
This is PERFECT for my quick updates for resetting password.

Do you have any code examples for VB or C#?
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
DhaestCommented:
On my last project, we did an encryption of the password through rijndael. This encrypted version was saved in the database. Each time a user logged in, we encrypted the password the users entered and compared it with the encrypted value in the database...
http://www.codeproject.com/dotnet/DotNetCrypto.asp
0
 
strickddAuthor Commented:
So using the link "HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string)" what would my SQL data type be to store this value? Would it be a varchar(32)?
0
 
DhaestCommented:
Varchar should be ok. I'm not sure of the length you need...
0
 
strickddAuthor Commented:
Okay, after a little research varchar(32) should work according to this: http://en.wikipedia.org/wiki/MD5.

Thanks for all the help!
0
 
DhaestCommented:
Glad I could help you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.