Click here to Skip to main content
15,887,436 members
Home / Discussions / C#
   

C#

 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 3:17
mveRichard Deeming23-Mar-15 3:17 
GeneralMessage Closed Pin
23-Mar-15 4:21
mveGerry Schmitz23-Mar-15 4:21 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 4:26
mveRichard Deeming23-Mar-15 4:26 
GeneralMessage Closed Pin
23-Mar-15 4:30
mveGerry Schmitz23-Mar-15 4:30 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 4:34
mveRichard Deeming23-Mar-15 4:34 
GeneralMessage Removed Pin
23-Mar-15 4:49
mveGerry Schmitz23-Mar-15 4:49 
SuggestionRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 3:28
mveRichard Deeming23-Mar-15 3:28 
QuestionSQLite encryption types for data Pin
DPaul199422-Mar-15 6:03
DPaul199422-Mar-15 6:03 
I have an application in C# which uses a SQLite database. In this database I have a table where I inserted a value encrypted with sha1, via sql query. Te problem is that I want to select that data and use it like:
C#
cmd.CommandText = "Select * from accounts where (username=@username and password=sha1(@password));";
cmd.Parameters.AddWithValue("@password", password);

OR
C#
cmd.CommandText = "Select * from accounts where (username=@username and password=@password);";
cmd.Parameters.AddWithValue("@password", sha1(password));

But from what I heard, I can't use sha1 like this, I have to use a function like this one, but it doesn't work:
C#
string sha1(string password) {
            byte[] byteArray = Encoding.UTF8.GetBytes(password);
            return Convert.ToBase64String(sha1.ComputeHash(byteArray);
        }

I receive error:
C#
sha1(string) is a method, which is not valid in the given context

The other thing, I heard about KDF ( key definition function) which it seems to be a better encryption type but I don't really know how to use it. Can anybody help me with that?

modified 22-Mar-15 12:11pm.

SuggestionRe: SQLite encryption types for data Pin
Richard MacCutchan22-Mar-15 6:12
mveRichard MacCutchan22-Mar-15 6:12 
GeneralRe: SQLite encryption types for data Pin
manchanx22-Mar-15 6:42
professionalmanchanx22-Mar-15 6:42 
GeneralRe: SQLite encryption types for data Pin
DPaul199422-Mar-15 7:14
DPaul199422-Mar-15 7:14 
SuggestionRe: SQLite encryption types for data Pin
Richard Deeming23-Mar-15 3:31
mveRichard Deeming23-Mar-15 3:31 
QuestionHow to add the current items into combobox at runtime Pin
Member 1154531322-Mar-15 3:55
Member 1154531322-Mar-15 3:55 
AnswerRe: How to add the current items into combobox at runtime Pin
Dave Kreskowiak22-Mar-15 4:42
mveDave Kreskowiak22-Mar-15 4:42 
GeneralRe: How to add the current items into combobox at runtime Pin
Mycroft Holmes22-Mar-15 14:13
professionalMycroft Holmes22-Mar-15 14:13 
GeneralRe: How to add the current items into combobox at runtime Pin
Dave Kreskowiak22-Mar-15 14:18
mveDave Kreskowiak22-Mar-15 14:18 
Questiondata from file Word in DataGridView Pin
Member 1071053221-Mar-15 5:10
Member 1071053221-Mar-15 5:10 
AnswerRe: data from file Word in DataGridView Pin
OriginalGriff21-Mar-15 5:22
mveOriginalGriff21-Mar-15 5:22 
GeneralRe: data from file Word in DataGridView Pin
Member 1071053221-Mar-15 6:24
Member 1071053221-Mar-15 6:24 
GeneralRe: data from file Word in DataGridView Pin
OriginalGriff21-Mar-15 6:32
mveOriginalGriff21-Mar-15 6:32 
GeneralRe: data from file Word in DataGridView Pin
Member 1071053221-Mar-15 6:47
Member 1071053221-Mar-15 6:47 
GeneralRe: data from file Word in DataGridView Pin
OriginalGriff21-Mar-15 6:57
mveOriginalGriff21-Mar-15 6:57 
GeneralRe: data from file Word in DataGridView Pin
Member 1071053221-Mar-15 7:24
Member 1071053221-Mar-15 7:24 
GeneralRe: data from file Word in DataGridView Pin
OriginalGriff21-Mar-15 7:47
mveOriginalGriff21-Mar-15 7:47 
GeneralRe: data from file Word in DataGridView Pin
Member 1071053221-Mar-15 8:04
Member 1071053221-Mar-15 8:04 

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.