What is the most secure hashing method? (PHP)

2020-02-14 10:49发布

I have just noticed that I have SHA512 in my PHP installation. Is it more secure than SHA1? Is it the most secure hashing method (I need for passwords, not for file integrity checking)?

标签: php hash
4条回答
做个烂人
2楼-- · 2020-02-14 10:54

Sha512 is better.. I also would recommend to use salt

Also see: Secure hash and salt for PHP passwords

查看更多
男人必须洒脱
3楼-- · 2020-02-14 11:00

In response to @Buddy, speed is not your friend when hashing; the slower the better. If someone is trying to brute force your password, an algorithm that takes a long time will mean the hack will take a long time.

查看更多
等我变得足够好
4楼-- · 2020-02-14 11:03

You can try This Link , it is a library for doing randomly generated salt hashing ,one of the most secure way of password hashing and user authentication.

查看更多
何必那么认真
5楼-- · 2020-02-14 11:14

I asked this question long time ago.

The answer is to always use an algorithm that has been designed for this, and has passed the test of time.

Currently, that algorithm would be bcrypt (there are 2 others but I don't remember their names). There are bcrypt implementations in every language, so just find one and use it. If computers keep getting faster (which would weaken your hashes), you can increase the number of rounds used to make it slower (it scales with hardware).

md5, sha1, sha512, etc: they suck for passwords. How much they suck? You can bruteforce average length passwords in hours or even seconds with your laptop. And that's ok, they weren't designed for securing passwords. They can still be used as cryptographic primitives though, eg: you can implement bcrypt using md5.

查看更多
登录 后发表回答