Skip to content

Instantly share code, notes, and snippets.

@paveltimofeev
Last active June 7, 2016 08:18
Show Gist options
  • Save paveltimofeev/73a17ba88ee79ba54712f465c858aa88 to your computer and use it in GitHub Desktop.
Save paveltimofeev/73a17ba88ee79ba54712f465c858aa88 to your computer and use it in GitHub Desktop.
Good storing passwords' hashes strategies

Good storing passwords' hashes strategies

Do not store users' passwords in plain text, store hash of password instead. But only hashing is not enough, use one of these techniques, to make your users' data more protected:

  • simple way:

passwordHash = hash( hash(passwd) + salt )

  • better one - will produce different hashes for users with the same passwords:

passwordHash = hash( hash(userid) + hash(passwd) + salt )

  • another one - salt is a random value for each user

passwordHash = hash( hash(passwd) + salt(userid) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment