Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MD5 Hash and store to SQL

Posted on 2007-08-08
8
Medium Priority
?
962 Views
Last Modified: 2012-05-05
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!
0
Comment
Question by:strickdd
  • 5
  • 3
8 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 19653174
MD5 Hash SQL Server Extended Stored Procedure
http://www.codeproject.com/database/xp_md5.asp
0
 
LVL 28

Author Comment

by:strickdd
ID: 19653300
This is PERFECT for my quick updates for resetting password.

Do you have any code examples for VB or C#?
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 19653350
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
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

 
LVL 53

Expert Comment

by:Dhaest
ID: 19653357
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
 
LVL 28

Author Comment

by:strickdd
ID: 19653387
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
 
LVL 53

Expert Comment

by:Dhaest
ID: 19653468
Varchar should be ok. I'm not sure of the length you need...
0
 
LVL 28

Author Comment

by:strickdd
ID: 19653519
Okay, after a little research varchar(32) should work according to this: http://en.wikipedia.org/wiki/MD5.

Thanks for all the help!
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 19653530
Glad I could help you
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Considering today’s continual security threats, which affect Information technology networks and systems worldwide, it is very important to practice basic security awareness. A normal system user can secure himself or herself by following these simp…
Phishing emails are a popular malware delivery vehicle for attack.  While there are many ways for an attacker to increase the chances of success for their phishing emails, one of the most effective methods involves spoofing the message to appear to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question