简体   繁体   中英

My Web Host Doesn't Support SHA-3 or SHA-2 with PHP. What should I do?

So my web host only supports SHA-1 and MD5, which are both pretty broken and out-dated. What can I do in this situation. Will I have to use an external site to hash my password (using POST requests), or would it be safe to do it through JavaScript. I'm not too keen on hashing passwords on the client's side though.

Is there any way I can get a SHA-2, SHA-3 or MD6 algorithm for PHP and use that as a custom method? If not, what would you suggest is the best way to overcome this problem?

Thanks in advance, DibDibs

EDIT

Here are the errors I am receiving when using different methods of hashing...

When I call hash("sha-256", $str) , I get this error: PHP Warning: hash(): Unknown hashing algorithm: sha-256

And when I call any algorithm directly, for example sha2($str) , I get this error: PHP Fatal error: Uncaught Error: Call to undefined function sha2()

I don't know how the host has disabled them, to me it looks like the functions (hashing algorithms) just aren't there to begin with.

Why don't you use password_hash() and password_verify() ? They are built in php functions for this purpose.

1)If you own the server you can try this method or use below libraries:

2) Don't use outside service for hashing.

3) If you don't own it ie if its shared hosting try talking to hosting provider if they could install it for you or try upgrading to some package which allows you to do so.

4) Or you could try nodejs for sha3 hashing & godaddy supports it.

5) Or try cloud hosting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM