security - Salting - the order of steps -


when salting password, correct way (or effective way)?

a. first hash password , hash hash of password salt this:

$password = "passwd";  $salt = "s0merndslt";  $password = sha1($password);  $salty = sha1($password.$salt); 

b. take password , salt , hash them this:

$password = "passwd";  $salt = "s0merndslt";  $salty = sha1($password.$salt); 

my apologies if has been asked before not find answer specific part of salting on so.

in reality, either case.

however, example #1 provides time tradeoff (slightly) slow down brute force password finders.

with advent of gpus, salting passwords is not enough. gpu-backed brute-force password tool, when given set of passwords find, can accomplish short passwords in matter of minutes (or seconds).

this why tools or algorithms such bcrypt or pbkdf#2 exist: iterate hashing operation many times produce large workload, makes finding passwords hash "infeasible" on commodity hardware.

when in doubt, don't implement own password hash solution! use bcrypt or pbkdf#2.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -