Home > Backend Development > PHP Tutorial > 加密解密 - 请问PHP如何通过openssl实现AES-256加密算法?

加密解密 - 请问PHP如何通过openssl实现AES-256加密算法?

WBOY
Release: 2016-06-06 20:09:01
Original
1098 people have browsed it

下面这段脚本是来自shell脚本提供的
加密命令:

<code>echo "xxxxxxxxxxxxxxxxxxxxxxxx" | openssl enc -aes-256-cbc -salt -k BCF2AEC59BD97C9D54D56FAAC1C48494 -base64</code>
Copy after login
Copy after login

解密命令:

<code>echo "xxxxxxxxxxxxxxxxxxxxxxx" | openssl enc -aes-256-cbc -salt -k BCF2AEC59BD97C9D54D56FAAC1C48494 -base64 -d</code>
Copy after login
Copy after login

我知道PHP有提供openssl模块,但是我对这个模块不了解,请问有没有了解的朋友,将上面这段代码改写成PHP的。非常感谢。

回复内容:

下面这段脚本是来自shell脚本提供的
加密命令:

<code>echo "xxxxxxxxxxxxxxxxxxxxxxxx" | openssl enc -aes-256-cbc -salt -k BCF2AEC59BD97C9D54D56FAAC1C48494 -base64</code>
Copy after login
Copy after login

解密命令:

<code>echo "xxxxxxxxxxxxxxxxxxxxxxx" | openssl enc -aes-256-cbc -salt -k BCF2AEC59BD97C9D54D56FAAC1C48494 -base64 -d</code>
Copy after login
Copy after login

我知道PHP有提供openssl模块,但是我对这个模块不了解,请问有没有了解的朋友,将上面这段代码改写成PHP的。非常感谢。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template