Using Triple DES(3DES) with PHP 7.1 [closed]

2019-09-14 18:50发布

问题:

I need a way to encrypt and decrypt with 3des. I'm currently using php 7.1

I found this question, but mcrypt is deprecated as of php 7.1 and I can't find any other resource for this.

回答1:

Continue to the Comments section of the function's manual and you'll see the following:

If you're writing code to encrypt/encrypt data in 2015, you should use openssl_encrypt() and openssl_decrypt(). The underlying library (libmcrypt) has been abandoned since 2007, and performs far worse than OpenSSL (which leverages AES-NI on modern processors and is cache-timing safe). [Link to the full comment]

So, Consider using openssl_encrypt() & openssl_decrypt() instead. They are still being supported and better performing.