Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6872433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:55:38+00:00 2026-05-27T03:55:38+00:00

I want to store login and password in sqlite database. This database in encrypted

  • 0

I want to store login and password in sqlite database. This database in encrypted using SQLCipher library. But password to encrypt database is separate issue. This password is stored in code of application. Login and password are provided by user to login to application. In C# there is the SHA256 class. If I use this class if it is enough ? Or rather I should use hash and salt or other methods ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:55:38+00:00Added an answer on May 27, 2026 at 3:55 am

    To store a user password in a database for login matters, you should use a hash function with a salt.

    SHA 256 is one of them, but there are better ones existing. I recommend you using the PBKDF2 derivative function. You can implement your own PBKDF2 hashing method using the Rfc2898DeriveBytes class provided in the .NET framework.

    Here is a quick how-to-do-it:

    int saltSize = 256;     // Number of bytes of the salt
    int iterations = 1000;  // Number of times we iterate the function
                            // The more we iterate, the more it is gonna take time.
                            //     The advantage of a great iterations number is to 
                            //     make brutforce attack more painful.
    int hashSize = 20;      // Number of bytes of the hash (the output)
    
    var deriveBytes = new Rfc2898DeriveBytes("mypassword", saltSize, iterations);
    byte[] salt = deriveBytes.Salt;
    byte[] hash = deriveBytes.GetBytes(hashSize);
    

    You just have now to store the salt and the hash in your database. Use Convert.FromBase64String and Convert.ToBase64String to get a string from a byte[] and vice-versa.


    Another alternative is to use bcrypt. See this interesting article.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store a large number of sound files in a database, but
I want to store a (random) salt next to the password in the database.
I want to store the username/password information of my windows service 'logon as' user
I want to store a large result set from database in memory. Every record
I want to download and parse webpage using python, but to access it I
How can I save something using FormsAuthentication? I don't want to store UserId through
Hey there, i want to store some session info from a database query, upon
I have this code, it is successfully storing the 'author_id' but I want it
I want to implement a salt into my login system but am a bit
I use PersistentObject to store login and password to enter directly in the application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.