使用PHP加密AES-256文件的最佳方式是什么? [英] What is the best way to encrypt files in AES-256 with PHP?

查看:131
本文介绍了使用PHP加密AES-256文件的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现一些在线教程可能有帮助,但我不确定有最好的选择。我想使用高度安全的算法加密文件(我有点偏执),但同时我正在寻找速度(我知道这有点矛盾)...所以我选择了AES-256 ..但是用PHP加密文件的最佳方法是什么?

解决方案

对于一个对称算法,使用mcrypt (请参阅 php.net/mcrypt )。



请注意,从安全的角度来看,使用该库可以避免风险,而不知道所有的功能。看看一些现成的解决方案,例如这个

(Btw,支持的密码是 here )。


I found some tutorials online that could help but I am not sure there the best options. I would like to encrypt the file with a highly secure algorithm (I am a bit paranoid) but at the same time I am looking for speed (I know it's a bit of a contradiction)... So I chose AES-256... But what is the best way to use AES-256 with PHP to encrypt files?

解决方案

For a symmetric algorithm, use mcrypt (see php.net/mcrypt).

Note though that it can be risky, from a security perspective, to use that library without knowing what everything does. Take a look at some ready made solutions, such as this.

(Btw, the ciphers supported are here).

这篇关于使用PHP加密AES-256文件的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆