PHP password encryption is slow

Source: Internet
Author: User
User password encryption using Password_hash
First hash timestamp, and then with the value of the hash after the static salt with the user password hash to get the password,
On-line running discovery is slow, the slowest time is about 2000ms,
Do you have any good solutions?

Reply content:

User password encryption using Password_hash
First hash timestamp, and then with the value of the hash after the static salt with the user password hash to get the password,
On-line running discovery is slow, the slowest time is about 2000ms,
Do you have any good solutions?

Add salt MD5 can, PHP's own encryption function is not conducive to cross-platform

1. Encrypt with MD5
Several commonly used cryptographic functions for 2.PHP: https://jellybool.com/post/php-encrypt-functions
3. Custom encryption//Baidu a lot of
4.PHP standard AES Encryption algorithm class http://www.oschina.net/code/snippet_99277_45148
GitHub is a PHP custom encrypted:
`

require_once("xxtea.php");$str = "Hello World! 你好,中国!";$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

Can let the logic of hash in MySQL do, MySQL has MD5 function, password function, you can try

The problem is found, Password_hash will pass three parameters, the last parameter is an array, there is a ' cost ' specifies the number of encryption iterations, the default 13 is 2^13 times. Increase the speed significantly after changing the number to small.

If you write a php extension
If you use Docker to deploy the environment.

  • 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.