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.