使用MD5从前端到后端安全地发送密码 [英] Sending password safely from the front-end to the back-end using MD5
问题描述
我已经通过MD5在我的数据库中加密了密码字段,并且我在后端加密了它,但是当用户输入密码时,它是纯文本的。
I've encrypted a password field in my DB by MD5, and I handle it encrypted in my back-end, but when user types their password in, it is in plain text.
有没有一种安全的方法可以将密码从前端传递到后端? MD5在这种情况下没有意义......
Is there a safe way to pass the password from the front-end to the back-end? MD5 doesn´t have sense in this case...
注意:我正在使用HTTPS和POST方法。
NOTE: I'm using HTTPS and the POST Method.
推荐答案
您可以考虑以下步骤来保护密码:
You can think about the following steps to protect the password:
-
优先使用HTTPS和HSTS在传输过程中保护密码;
Use HTTPS preferably with HSTS to protect the passwords during transport;
使用密码哈希(如bcrypt而不是MD5)来保护服务器上的密码。
Use a password hash such as bcrypt instead of MD5 to protect the password on the server.
- HASH密码盐;
- 为bcrypt使用高工作因子。
MD5不是哈希的最佳方式。 MD5不再被认为是安全的。
MD5 is not the best way to hash. MD5 is not considered secure anymore.
MD5不是加密;不要加密密码,哈希它们,加密可以解密,哈希不能反转。
MD5 is not encryption; don't encrypt passwords, hash them, encryption can be decrypted, hashing cannot be reversed.
这篇关于使用MD5从前端到后端安全地发送密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!