473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

best way to save passwords in SQL server?

I want to know what's the best way to save passwords in SQL server using C#?
Aug 27 '07 #1
8 7999
Jassim,

Honestly, don't. Saving passwords is a bad, bad idea. You are better
off creating a challenge/response mechanism.

However, if you have to save passwords, then encrypt the column, and
make sure that you secure the encryption key well. Here is some information
on how to encrypt a column of data:

http://msdn2.microsoft.com/en-us/library/ms179331.aspx
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jassim Rahma" <jr****@hotmail.comwrote in message
news:5D**********************************@microsof t.com...
>I want to know what's the best way to save passwords in SQL server using
C#?

Aug 27 '07 #2
I want to know what's the best way to save passwords in SQL server using C#?

Use System.Security.Cryptography and convert password into hashes use
SHA1/MD5

Aug 27 '07 #3
Iapain wrote:
>I want to know what's the best way to save passwords in SQL server using C#?

Use System.Security.Cryptography and convert password into hashes use
SHA1/MD5
Note that hashing algorithms are by nature one-way, meaning there isn't
a way to "unhash" something into a password again if you need to
retrieve it. Storing hashes is generally better, but it will mean that
should you ever actually need/want to see the password, you will be
unable to do so (easily, see below).

It used to be that hashes were viewed as offering more security in the
event of a system compromise but that's not necessarily true anymore
with the advent of Rainbow Tables and cheap disk space.

Chris.
Aug 27 '07 #4
Well, if you use a salt value then any attack using rainbow tables is
easily avoided.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
Iapain wrote:
>>I want to know what's the best way to save passwords in SQL server using
C#?

Use System.Security.Cryptography and convert password into hashes use
SHA1/MD5

Note that hashing algorithms are by nature one-way, meaning there isn't a
way to "unhash" something into a password again if you need to retrieve
it. Storing hashes is generally better, but it will mean that should you
ever actually need/want to see the password, you will be unable to do so
(easily, see below).

It used to be that hashes were viewed as offering more security in the
event of a system compromise but that's not necessarily true anymore with
the advent of Rainbow Tables and cheap disk space.

Chris.

Aug 27 '07 #5
Nicholas Paldino [.NET/C# MVP] wrote:
Well, if you use a salt value then any attack using rainbow tables is
easily avoided.
Assuming they didn't already know the algorithm used. Salts do help, but
they don't invalidate rainbow tables -- just those using a different
algorithm to generate hash entries. Any way you slice it a total system
compromise is bad.

Chris.
Aug 27 '07 #6

thsn how can read it?

can you show an example on how to create the passowrd and read it back using
a login textbox?

"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
Iapain wrote:
>>I want to know what's the best way to save passwords in SQL server using
C#?

Use System.Security.Cryptography and convert password into hashes use
SHA1/MD5

Note that hashing algorithms are by nature one-way, meaning there isn't a
way to "unhash" something into a password again if you need to retrieve
it. Storing hashes is generally better, but it will mean that should you
ever actually need/want to see the password, you will be unable to do so
(easily, see below).

It used to be that hashes were viewed as offering more security in the
event of a system compromise but that's not necessarily true anymore with
the advent of Rainbow Tables and cheap disk space.

Chris.
Aug 28 '07 #7
Jassim Rahma wrote:
>
thsn how can read it?

can you show an example on how to create the passowrd and read it back
using a login textbox?
Nicholas already provided a response on this earlier when he told you
that it was a bad idea to save passwords, but if you absolutely must,
use an encrypted column of data. There's a link in that post that
explains it fairly well.

Chris.
Aug 28 '07 #8
Jassim Rahma wrote:
>
"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
>Iapain wrote:
>>>I want to know what's the best way to save passwords in SQL server
using C#?

Use System.Security.Cryptography and convert password into hashes use
SHA1/MD5

Note that hashing algorithms are by nature one-way, meaning there
isn't a way to "unhash" something into a password again if you need to
retrieve it. Storing hashes is generally better, but it will mean that
should you ever actually need/want to see the password, you will be
unable to do so (easily, see below).

It used to be that hashes were viewed as offering more security in the
event of a system compromise but that's not necessarily true anymore
with the advent of Rainbow Tables and cheap disk space.

Chris.
>
thsn how can read it?

can you show an example on how to create the passowrd and read it back
using a login textbox?

You would generate a hash of the password they entered in the textbox
and compare it to your stored hash, if they are equal then its the same
password.
Taking care to go through the same salting routine if used.

JB
Aug 31 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
11
by: Florian Lindner | last post by:
Hello, I've a scripts that allows limited manipulation of a database to users. This script of course needs to save a password for the database connection. The users, on the other hand need read...
14
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program...
7
by: Yatin Soni | last post by:
If my server doesnt support ASP, what would be the next best language to use. I need to create a simple security page... where a database on the server stores usernames and passwords. i need...
20
by: Greg | last post by:
I'm fairly new to access (using 2002) and am setting up a DB for work. along with each record the user also needs to make a flow diagram (previously, these reports were composed in word and they...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
6
by: Pat Carden | last post by:
Hi, We need to allow webusers to upload a file on our website (on Server3, all servers run Server 2003, remotely hosted) and eventually save it on our SBS Server (Server2) which is not exposed...
15
by: Dino Vliet | last post by:
Hi folks, probably this is a question you've heard so many times but I wasn't able to find a solution to it. I'm using a shell script to create a textfile for me. It looks like...
5
by: Macca | last post by:
Hi, My application uses passwords to limit access to certain parts of the app. I was considering storing these in my database but have heard that there can be problems with this. I have heard...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.