I recently got in trouble with saving user data in a MySQL-Database and i looked for methods in hashing Passwords to save them in a DB.
Til Yesterday i saved them unsalted as a md5-Hash, but google told me to stop immediately with it. So i changed my Method.
I add to the User-Password his First/Last name and his Username as salts and hash them with SHA512 in PHP and save it in the MySQL-DB.
But i looked for other, more common uses for that and like many sites tole me, SHA is amde for fast-Hashing and it isnt secure enough for Passwords, i should better use things like bcrypt.
So my question is, is sha512 with salts really that bad at Password-Hashing, so they get cracked easily with Rainbow-Tables or simple brute-Force? I thought sha512 is pretty safe
And how do i use the bcrypt-hashfunction in PHP? I didnt found a solution, that worked for me. Curently on my register.php i safe them like that:
$passwordHash = hash('sha512', $password . $vName . $nName . $username);
$result = mysqli_query($connect, "Insert into Accounts Values ('$username', '$passwordHash', '$email', '$vName', '$nName', $zip, '$ort', '$street', $hNr, '$telVor', '$tel')");
But how do i use bcrypt?
Thx!