如何加密mysql数据库中的数据? [英] How can I encrypt data in mysql database?

查看:158
本文介绍了如何加密mysql数据库中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP文件,允许用户在MySql数据库中插入文本。我想要加密数据。 (对我来说,任何加密都可以... MD5,SHA1,SHA512,任何一个)当用户从数据库中请求数据时,它将显示为普通的纯文本(由他输入的值)。请帮助我怎么做?

解决方案

MD5,SHA1,SHA512是散列和压缩工具,所以不可能通过这些算法解密 在哈希和加密之间)。


这两个PHP函数可以满足您的具体情况的需要:您可以使用此功能加密,这一个到解密


I have a PHP file which allows users to insert text into the MySql database. I want that data to be encrypted. (Any encryption would be ok for me... MD5, SHA1, SHA512, any of them) And when the user requests the data from the database, it is shown as regular plain text (The value entered by him). Please help me how can I do it?

解决方案

MD5, SHA1, SHA512 are hashing and compression tools, so it is impossible to decrypt text that is cloaked by these algorithms (check the difference between hashing and encryption).

These 2 PHP functions could suit your needs for this specific case: you case use this function to encrypt and this one to decrypt

这篇关于如何加密mysql数据库中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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