Found in the official PHP manual there are so many encryption algorithms, I would now like to encrypt the user's password, as well as the user login token. Can you tell me which encryption algorithm to use is better?
PS: The user password should be irreversible. User Login token should be reversible because I need to reverse token to get some information from the user.
Thanks:)
Reply content:
Found in the official PHP manual there are so many encryption algorithms, I would now like to encrypt the user's password, as well as the user login token. Can you tell me which encryption algorithm to use is better?
PS: The user password should be irreversible. User Login token should be reversible because I need to reverse token to get some information from the user.
Thanks:)
It is recommended to use the C extension of MCrypt, which encapsulates almost all cryptographic algorithms and is fast and secure.
Implementations can refer to cryptographic modules in the Laravel framework: https://github.com/laravel/framework/tree/master/src/Illuminate/Encryption
I think so: 1. Do not simply use a cryptographic algorithm directly, you can if some of your own algorithm to do this, then even if you use the algorithm is cracked, they may not be able to crack your password. An example of a simple example:
Then, if the cracked people can't get the strings behind you, they will not get your password encryption reverse engineering.
2. I've used tokens, and I've seen several other companies use tokens. At least in the inside I have seen, there is no need to reverse the situation of token to obtain information. Token is used to verify the identity, and then the information needed should be obtained from the server, rather than blindly trusting the user to submit the information. Generally speaking, the client and server should have the same encryption method. The service side, based on the same method, consolidates local and client-submitted information for calculation, obtains the same token, proves that the client has the correct authorization, and therefore gives a certain permission, rather than the use of the message.