How to use PHP to implement a class with public key encryption
This article mainly introduces how to use PHP to achieve with public key encryption class, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Class code:
Page execution result
Result 1:
Result 2:
As you can see from the above results, the encrypted string generated by each encryption is different, which is random.
When decrypting, you need to use the public key when encrypting, otherwise it cannot be decrypted. If you use the 'qttc',' public key to decrypt, you also need to use this' qttc' as the public key to decrypt, otherwise you can't decrypt it.
Thank you for reading this article carefully. I hope the article "how to use PHP to achieve encryption with public key" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!