Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best hash algorithm to use in PHP/MYSQL [closed]

Tags:

php

mysql

Which is the best recommended algorithm to use for encrypting passwords in php/mysql

like image 834
Gatura Avatar asked Jan 12 '10 10:01

Gatura


2 Answers

SHA-512 with a salt is a good & secure way to hash a password. If that's not available you have SHA-1 but it's security is considered a bit weak these days, especially if you don't use a salt.

like image 169
TravisO Avatar answered Oct 05 '22 13:10

TravisO


Most people now agree SHA is not the best way to go, since these algorithms are bad at resisting brute-force attacks. It's better to use bcrypt, scrypt or PBKDF2 see this Q&A.

Here is a guide on how to implement bcrypt in php.

like image 38
eldh Avatar answered Oct 05 '22 12:10

eldh