User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,624 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,145 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 3273 | Replies: 3 | Solved
Closed Thread
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Help How to Hash and Store in Database

  #1  
Aug 21st, 2005
I am currently working to store passwords into my SQLDatabase table. I would like to hash the password columns to make it more secure. I know that i can use either SHA1 or MD5.

Refering to this website, http://www.codersource.net/csharp_sh...ncryption.html, i try to write the VB.NET codes.

Private Sub EncryptPassword()

FormsAuthentication.HashPasswordForStoringInConfigFile(txtbox_password.Text, "SHA1")

myDataset.Tables("Member").Rows(myDataIndex)("MemberPassword") = txtbox_confirmpass.Text
dtDataAdapter.Update(mydataset)
End Sub

The hashing works but i am unable to insert it into the database as the hash value. Also, Forms authentication requires me to manually copy and paste the username and password each time to store the hash to the table. I want to be able to store the hashed password to the table directly and i think i can use update statement but it isn't working, my table name is Member, the password column is MemberPassword. Would someone kindly help me. :cry:
AddThis Social Bookmark Button
 
Join Date: Jul 2005
Location: Kansas City, Missouri
Posts: 17
Reputation: cambia is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
cambia's Avatar
cambia cambia is offline Offline
Newbie Poster

Re: How to Hash and Store in Database

  #2  
Aug 28th, 2005
What is it that's not working? What is the error or exception you're getting?

You should be able to use the Update method to store data in the database, but your DataAdapter must be setup properly and the types and lengths of your database fields must be capable of storing the hash string. I think your problem is more about reading and writing to the database than hashing a password. Try doing some simple experiments to be sure you can use the Fill and Update methods of the data adapter in the way you expect.
 
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: How to Hash and Store in Database

  #3  
Aug 29th, 2005
What is the data_type you have set for the column storing this hashed password? char, varchar?
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
 
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Solution Re: How to Hash and Store in Database

  #4  
Sep 7th, 2005
Char, thanks alot, the problem has been resolved!
 
Closed Thread

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 1:30 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC