Php password encryption is slow

Source: Internet
Author: User
User password encryption uses password_hash to hash the timestamp first, and uses the hash value and static salt to hash the password to get the password. Online operation is found to be slow, and the slowest time is about 2000 ms, is there any good solution? Password_hash is used for user password encryption.
Hash the timestamp first, and then hash the hash value with the static salt and the user password to get the password,
The online operation was found to be slow, with the slowest time being about 2000 ms,
Is there any good solution?

Reply content:

Password_hash is used for user password encryption.
Hash the timestamp first, and then hash the hash value with the static salt and the user password to get the password,
The online operation was found to be slow, with the slowest time being about 2000 ms,
Is there any good solution?

Add md5 to the salt, and the built-in encryption function of php is not conducive to cross-platform

1. Use MD5 Encryption
2. Several Common encryption functions of PHP: https://jellybool.com/post/php-encrypt-functions
3. Custom encryption // many of Baidu's
4. PHP Standard AES encryption algorithm class http://www.oschina.net/code/snippet_99277_45148
A php custom encryption on github:
`

Require_once ("xxtea. php"); $ str = "Hello World! Hello, China! "; $ Key =" 1234567890 "; $ encrypt_data = xxtea_encrypt ($ str, $ key); $ decrypt_data = xxtea_decrypt ($ encrypt_data, $ key ); if ($ str = $ decrypt_data) {echo "success! ";} Else {echo" fail! ";}

?> '

Https://github.com/xxtea/xxtea-php

The hash logic can be implemented in mysql. mysql has MD5 and password functions. You can try it.

If the problem is found, password_hash will pass in three parameters. The last parameter is an array with a 'cost' specifying the number of encryption iterations. The default value is 13, which is 2 ^ 13. After the number is changed to a smaller value, the speed increases significantly.

If you write a PHP Extension
If you deploy the environment with Docker.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.