哪个是最好的加密方法64或MD5? [英] Which is best encryption method base 64 or MD5?

查看:148
本文介绍了哪个是最好的加密方法64或MD5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用MD5加密将密码存储在数据库中。之前我们没有密码重置功能。但现在我们正在实施它。所以我无法解密MD5并将密码发送给用户。但是我可以做,如果它是加密在base64.Now我有点困惑,这是最好的加密方法。

我已经做了强密码的客户端验证(如8个字符长度,特殊字符等) )

I am currently using MD5 encryption for storing the password in the database. We didn't have the password reset functionality before. But now we are implementing it. So I can't decrypt MD5 and send the password to the user. But I can do if it is encrypted in base64.Now I am little bit confused which is best encryption method.
I already did the client side validation for strong password (like 8 char length, special characters etc).

推荐答案

Base 64不是加密机制,它是一种编码方案。它很容易颠倒,所以它不是保护关键数据的好选择。

Base 64 is not an encryption mechanism, it is an encoding scheme. It is easily reversed, so it is not a good choice for protecting critical data.

密码的常用方法是将其与MD5类似的哈希,然后存储哈希。当用户再次登录时,哈希输入密码,并将其与存储的哈希进行比较。

The common approach for passwords is to hash them with something like MD5, and then store the hash. When the user logs in again, hash the input password, and compare that to the stored hash.

如果用户忘记密码,您不应该能够告诉他这是什么。相反,请允许他将其重置为别的东西(大概是他可以记住的东西)。

If the user forgets his password, you should not be able to tell him what it is. Instead, allow him to reset it to something else (presumably something he can remember).

另外,正如@Phil Brown所说, MD5不被认为是强大的加密机制。 SHA-1将更适合此任务。

Also, as @Phil Brown mentions, MD5 is not considered a strong encryption mechanism. SHA-1 would be better suited for this task.

Base 64 编码通常用于通过仅允许ASCII文本的机制传输二进制数据。

Base 64 encoding is generally used to transmit binary data over a mechanism that only allows ASCII text.

这篇关于哪个是最好的加密方法64或MD5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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