Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to implement a password manager in C and I had a question about the proper steps in implementing the crypto. I looked at some implementations, google talks on crypto and what the standards are.

so I just wanted to list out the steps in the program and I wanted to make sure I was doing it right.

  1. If its a first time the program is being used, it will ask the user for a password to use
  2. This password will then be hashed with some algorithm (SHA1?) and then stored in a file
  3. Then a password storage file is created and the user can add, delete or view the entries
  4. When the user is done, the password storage file is encrypted (use the user password as input to openssl, openssl aes-256-cbc -salt -in test.txt -out test.aes, this is from the command line...I'd have to do the equivalent in C)
  5. exit
  6. when the user reopens the application, the user password is checked against the stored hash
  7. if it passes, the password is sent to openssl to decrypt the password storage file
  8. the user does some stuff and exits, the password storage file is reencrypted

So what do you guys think? Let me know if there are C specific crypto resources I can use. Thanks for your help!

share|improve this question
You are missing a critical point: given the hash of a password that most humans can remember, it is possible to find the password. There's an industry doing that, and variations. That's why we have password-based key derivation functions, and key stretching. Investigate scrypt. – fgrieu Apr 21 '14 at 7:24
ok thanks for your help! i will check out scrypt – jti107 Apr 21 '14 at 15:06
i found this to be a helpful resource – jti107 Apr 22 '14 at 6:00
I disagree with one sentence in the FAQ: (for password protection on a server) "What hash algorithm should I use? (..) Any modern well-tested cryptographic hash algorithm, such as SHA256, SHA512, RipeMD, WHIRLPOOL, SHA3, etc". This particular alternative forgets key stretching and is thus poor advice (other alternatives given in the same list are much better). – fgrieu Apr 22 '14 at 6:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.