你如何使用 bcrypt 在 PHP 中散列密码? - How do you use bcrypt for hashing passwords in PHP?
问题:
Every now and then I hear the advice "Use bcrypt for storing passwords in PHP, bcrypt rules".我时不时地听到“使用 bcrypt 在 PHP 中存储密码,bcrypt 规则”的建议。
But what is bcrypt
?但什么是bcrypt
? PHP doesn't offer any such functions, Wikipedia babbles about a file-encryption utility and Web searches just reveal a few implementations of Blowfish in different languages. PHP 不提供任何这样的功能,维基百科喋喋不休地谈论一个文件加密实用程序,而网络搜索只是揭示了一些不同语言的Blowfish实现。 Now Blowfish is also available in PHP via mcrypt
, but how does that help with storing passwords?现在 Blowfish 也可以通过mcrypt
在 PHP 中使用,但这对存储密码有什么帮助? Blowfish is a general purpose cipher, it works two ways. Blowfish 是一种通用密码,它有两种工作方式。 If it could be encrypted, it can be decrypted.如果可以加密,则可以解密。 Passwords need a one-way hashing function.密码需要一种单向散列函数。
What is the explanation?解释是什么?
解决方案:
参考一: http://stackoom.com/question/K7Uv参考二: How do you use bcrypt for hashing passwords in PHP?
- 获取目录中经过过滤的文件列表 - Get a filtered list of files in a directory
- SSH 到 Elastic Beanstalk 实例 - SSH to Elastic Beanstalk instance
- 如何运行单个 RSpec 测试? - How to run a single RSpec test?
- Android 获取当前区域设置,而不是默认设置 - Android get current Locale, not default
- Android:清除后退堆栈 - Android: Clear the back stack
- Process.start:如何获得输出? - Process.start: how to get the output?
- 带有泛型的 Typescript 箭头函数的语法是什么? - What is the syntax for Typescript arrow functions with generics?
- 检查数字是否有小数位/是整数 - Check if a number has a decimal place/is a whole number
- 如何替换SQL Server表列中的字符串 - How to replace a string in a SQL Server Table Column
- 如果我使用 const,为什么 JSHint 会抛出警告? - Why does JSHint throw a warning if I am using const?
- 如何将ListView放入ScrollView中而不会折叠? - How can I put a ListView into a ScrollView without it collapsing?
- 最后插入的 ID 的 PostgreSQL 函数 - PostgreSQL function for last inserted ID
- 为什么不使用java.util.logging? - Why not use java.util.logging?
- 自我类型和特征子类之间有什么区别? - What is the difference between self-types and trait subclasses?
- 为什么我们需要 Python 中的“finally”子句? - Why do we need the “finally” clause in Python?
- 将块内的变量分配给块外的变量 - Assign a variable inside a Block to a variable outside a Block
- MySQL:如何允许远程连接到 mysql - MySQL: How to allow remote connection to mysql
- Pylint、PyChecker 还是 PyFlakes? [关闭] - Pylint, PyChecker or PyFlakes? [closed]
- 在 T-SQL 中选择一个表变量 - SELECT INTO a table variable in T-SQL
- 如何在 JavaScript 循环中添加延迟? - How do I add a delay in a JavaScript loop?