12345 will always display as 8cb2237d0679ca88db6464eac60da96345513964 with a direct hash.
This means that if you created a database for each possible result, you could theoretically find the result and see what the original input to the sha1 function was.
This is a security issue where problems such as dictionary attacks and Rainbow tables ( http://en.wikipedia.org/wiki/Rainbow_table ) are possible.
To get around this, you should never use a failed hash. those. you always set your hash using the value you know.
For example, sha1 ("12345" + "mySalt").
Now your hash is easy to generate, but not like any other person in the world who used sha1.
From a technical point of view, you should also never reuse the same salt twice, but this is a more complex concept.
EDIT . As indicated below, PBKDF2 and a random salt should be used, not a static and hash. Much better for security.
source share