加密数据库内容
如果我没记错的话,当你想加密数据库中的内容时,你会使用md5。我现在用它作为密码。但现在我想为企业客户的所有个人信息等添加加密。以下是我的问题:
如果我对所有内容进行 md5,php 会以正常方式显示所有内容,就像没有 md5 一样吗?
当我允许编辑内容时,我将不得不显示不带 md5 的信息,然后在提交时添加 md5,对吗?
如果有人访问数据库,他们只会看到 md5。但如果他们下载它然后删除 md5,他们不会看到所有信息吗?
正如你所知,我是一个承受压力的业余爱好者。如果我对md5的想法有误,请纠正我。如果是这样,我如何加密数据库,记住信息将由用户随时编辑。
谢谢。
If i am not wrong, when you want to encrypt the content in the database you will use md5. I use that right now for passwords. But now i want to add encryption to all personal information, etc for enterprise clients. Below are my questions:
If I md5 everything, will php display everything the normal way, like without the md5?
When i allow editing of the content, i will have to display the info without the md5 and then add md5 upon submission, correct?
If someone gets access to the database, they will only see md5. But if they download it and then remove md5, wouldn't they see all the info?
As you can tell i am an amateur under pressure. Please correct me if i am wrong with my thinking of md5. If so, how can i encrypt the databases keeping in mind that info will be edited by users anytime.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
MD5是一种散列算法,而不是加密算法。散列是一种方式;也就是说,您无法将散列数据恢复为原始数据。 MD5 用于对密码进行哈希处理(嗯,哈希算法 用于对密码进行哈希处理...MD5 通常被认为是不安全的,不适合涉及安全的应用程序...例如密码),因为您所关心的一切是密码是否匹配,而不是密码实际是什么。这允许您在数据库中存储一个令牌(哈希),您可以使用该令牌进行比较,而无需实际存储密码。
如果您要对数据库数据进行应用程序级加密(而不是依赖任何特定于 RDBMS 的加密功能),则在将数据放入之前,您始终必须对数据进行加密(以代码形式) > 数据库并在您从数据库中取出数据(以代码形式)时对其进行解密。对于这样的系统,通常使用AES等对称密钥加密算法。
MD5 is a hashing algorithm, not an encryption algorithm. Hashing is one way; that is, you cannot take hashed data and turn it back into the original data. MD5 is used to hash passwords (well, hashing algorithms are used to hash passwords...MD5 is generally regarded as insecure and not suitable for applications involving security...like passwords) because all you care about is whether or not the passwords match, not what the password actually is. This allows you to store a token in your database (the hash) that you can use to compare without actually storing the password.
If you're going to do application-level encryption of database data (rather than relying on any RDBMS-specific encryption features), you will always have to encrypt the data (in code) before you put it into the database and decrypt the data (in code) whenever you take it out of the database. For systems like this, a symmetric key encryption algorithm like AES is generally used.
MD5是一个哈希函数!是一个单向函数。
您无法解码 MD5 哈希值!
如果您使用 MD5 对内容进行编码,您就会丢失数据!
而是使用 3DES、BLOWFISH 或其他加密方法!
加密取决于不同的数据库。或多或少每个数据库都有一个可供使用(和付费)的加密模块
MD5 is an hashing function! Is a one-way function.
You cannot decode a MD5 hash !
If you encode you content with MD5, you loose the data!!!
Instead use 3DES, BLOWFISH or other encryption methods!
Encription depends from DB to DB. More or less every db has an encription module to use (and pay)
据我所知,MD5 目前并不是真正的安全哈希函数。网络上有一些地方提供反向 MD5 服务,他们收集了一个巨大的字符串数据库及其 MD5 等效项。尝试使用 SHA-512 之类的东西并使用迭代哈希等技术来使其更安全。 PHP 有一个 crypt() 库,您可能想查看一下,或者也许使用 SQLite 数据库加密。
As far as I know, MD5 is known not to really be a secure hashing function nowadays. There are places out there on the web offering reverse MD5 services, where they collect a huge database of strings with their MD5 equivalent. Try going for something like SHA-512 and use techniques like iterative hashing to make it more secure. PHP has a crypt() library you might like to checkout, or use SQLite database encryption maybe.
没有。一切都将是 md5 摘要。原始数据(几乎)不可能从摘要中恢复。
由于 md5 摘要无法(轻松)解码为原始数据,因此您必须将原始信息保存在某处。
没有。 md5 摘要无法(轻松)反转以重建任何原始信息。
Nope. Everything will be an md5 digest. The original data will be (almost) impossible to recover from the digest.
Since the md5 digest cannot (easily) be decoded into the original data, you'll have to keep the original info somewhere.
Nope. The md5 digest cannot (easily) be reversed to reconstruct any of the original info.
MD5是一种单向散列函数。它不会被解密。刚刚加密。
MD5 is one way hashing function. It won't be decrypted. JUST ENCRYPTED.