Click here to Skip to main content
15,914,312 members
Home / Discussions / C#
   

C#

 
Questionprocess id! Pin
Adeel Chaudhry1-May-07 3:42
Adeel Chaudhry1-May-07 3:42 
AnswerRe: process id! Pin
Tarakeshwar Reddy1-May-07 3:51
professionalTarakeshwar Reddy1-May-07 3:51 
QuestionDynamic Array Pin
Alireza38391-May-07 3:09
Alireza38391-May-07 3:09 
AnswerRe: Dynamic Array Pin
Guffa1-May-07 4:05
Guffa1-May-07 4:05 
JokeRe: Dynamic Array Pin
Tarakeshwar Reddy1-May-07 4:08
professionalTarakeshwar Reddy1-May-07 4:08 
JokeRe: Dynamic Array Pin
PIEBALDconsult1-May-07 19:06
mvePIEBALDconsult1-May-07 19:06 
QuestionVS2005 problem Pin
netJP12L1-May-07 3:06
netJP12L1-May-07 3:06 
QuestionRecover encrypted field from a database Pin
aecordoba1-May-07 2:56
aecordoba1-May-07 2:56 
Hi there!
I want to save an encrypted password in a database in order to authenticate the users of my application (on C# 2.0).
So, I encrypted the password provided by the user, as following:

UnicodeEncoding unicodeEncoding = new UnicodeEncoding();<br />
byte[] passwordArray = unicodeEncoding.GetBytes(password);<br />
SHA1Managed sha1Managed = new SHA1Managed();<br />
byte[] encryptedPassword = sha1Managed.ComputeHash(passwordArray);


Then, I saved the password in 'varbinary(160)' field in a table of database (SQL Server 2005):

DataSet.Users.AddUsersRow(userName, encryptedPassword);<br />
UsersTableAdapter userTableAdapter = new UsersTableAdapter();<br />
userTableAdapter.Update(DataSet.Users);


How can I recover this encrypted password in order to compare it with a new encrypted password provided by the user?

This code:

byte[] passwordArray = row["Password"];

doesn't compile because "it can't convert object to byte[]".

Thank you, in advance.

--
Adrián Córdoba

AnswerRe: Recover encrypted field from a database Pin
Colin Angus Mackay1-May-07 4:07
Colin Angus Mackay1-May-07 4:07 
GeneralRe: Recover encrypted field from a database Pin
aecordoba1-May-07 12:03
aecordoba1-May-07 12:03 
QuestionCustom collections Pin
kskris1-May-07 2:31
kskris1-May-07 2:31 
AnswerRe: Custom collections Pin
Tom John1-May-07 2:40
Tom John1-May-07 2:40 
Questionhow i disable ALT+F4 key Pin
fgfdhghgfd1-May-07 2:10
fgfdhghgfd1-May-07 2:10 
AnswerRe: how i disable ALT+F4 key Pin
Christian Graus1-May-07 2:11
protectorChristian Graus1-May-07 2:11 
GeneralRe: how i disable ALT+F4 key Pin
Giorgi Dalakishvili1-May-07 2:35
mentorGiorgi Dalakishvili1-May-07 2:35 
GeneralRe: how i disable ALT+F4 key Pin
PIEBALDconsult3-May-07 8:51
mvePIEBALDconsult3-May-07 8:51 
QuestionFinding the process(s) that have locked a file Pin
MrEyes1-May-07 2:07
MrEyes1-May-07 2:07 
AnswerRe: Finding the process(s) that have locked a file Pin
RSArockiam1-May-07 2:41
RSArockiam1-May-07 2:41 
Questionarray Pin
arkiboys1-May-07 2:05
arkiboys1-May-07 2:05 
AnswerRe: array Pin
Christian Graus1-May-07 2:07
protectorChristian Graus1-May-07 2:07 
Questionhow create new DataTable from result of DataGrid after search by DataView Pin
zeroonea1-May-07 1:48
zeroonea1-May-07 1:48 
QuestionUnable to get installer types deployment error Pin
rachitdamani1-May-07 1:41
rachitdamani1-May-07 1:41 
AnswerRe: Unable to get installer types deployment error Pin
MaxRelaxman1-May-07 4:31
MaxRelaxman1-May-07 4:31 
QuestionHow can I delete a row record with C# 2005 in an access table? Pin
memix1-May-07 1:22
memix1-May-07 1:22 
AnswerRe: How can I delete a row record with C# 2005 in an access table? Pin
RSArockiam1-May-07 2:22
RSArockiam1-May-07 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.