Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SQLite encryption hashing with SHA1 or KDF

SQLite encryption hashing with SHA1 or KDF

SQLite encryption hashing with SHA1 or KDF

Hi everyone. I have an application which uses a SQLite database. In database, I have a table and in one column, I have a value inserted from SQL code which is encrypted with sha1. But, I want to use it in my C# application like this:
[code C#]
cmd.CommandText = "Select * from accounts where (username=@username and password=sha1(@password));";
cmd.Parameters.AddWithValue("@password", password);


[code C#]
cmd.CommandText = "Select * from accounts where (username=@username and password=@password);";
cmd.Parameters.AddWithValue("@password", sha1(password));
But, I understand that I can't use sha1 in SQLite, because it doesn't exists any library for that. But, exists a function that help like this one:
[code C#]
string sha1(string input) {
byte[] byteArray = Encoding.UTF8.GetBytes(input);
return Convert.ToBase64String(sha1.ComputeHash(byteArray);
But is not working, I get error at
[code C# Error line]sha1.ComputeHash(byteArray);[/code]
Error code:
[code C# Error code]sha1(stirng) is a method,which is not valid in the given context[/code]
So, I looked for other solution and I found KDF, but I don't really understand how to use it. Can anybody help me with that? It's fine also if manage to encrypt it with sha1.

RE: SQLite encryption hashing with SHA1 or KDF

Why "


" is not working?

RE: SQLite encryption hashing with SHA1 or KDF

Oups, my mistake, code tag with name doesn't work guys

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close