Introduction
When you save a password in a DB, you don't have to save the password requested by Client. In most cases, the Hash algorithm is used to store it in the DB. Even if the hashized password is leaked by hackers, it is not easy for hackers to log in.
Problem
However, just as they find answers to everything, hackers found solution to decrypt them. The most well-known decoding method(hacking) is Rainbow table
. It's called Rainbow table attack
.
Rainbow Table has hash result values for many passwords, so hackers compare the content on the table with the password they took and decrypt it. This is called Rainbow Table Attack.
In the old days, computers and algorithms weren't good, so it wasn't a big problem. But these days, with the improvement of computers and algorithms, it is possible to decrypt passwords by comparing them to tables at high speed.
To solve this problem, you can choose a complex hash algorithm, but this can make password generation time longer, causing inconvenience to users and making DB sizes huge.
SALT

Summary
- Save as a different variable each time
- Putting words before or after a password
- Save to Database
Additional Method
There are many ways other than Salt.
Pepper
Although Pepper is similar to salt, it uses fixed variable. Because the pepper is a fixed variable, it can be stored and used in places such as env, and there is no need for the process of creating variables. However, it's not as good as Salt in terms of security.
Key stretch

In conclusion, the password is created to add the salt to password and use Key Stretch method in order to make it more secure.