Libsodium(钠)VS Bcrypt

Libsodium (Sodium) VS Bcrypt

我发现 Symfony 4.4 使用 Libsodium (Sodium) 作为密码的编码方法,并在未安装 Sodium 时回退到 Bcrypt。

Sodium 比 Bcrypt 好吗?

如果是这样,为什么更好?有什么区别?

我对密码哈希器也很陌生,我自己也想知道类似的东西,所以这就是我的发现。

documentation 声明如下:

Argon2i support is provided through the libsodium library, which selects the Argon2 variant (argon2d, argon2i or argon2id) automatically based on the host system.


那么它实际上归结为 Argon2 vs Bcrypt

那么 an explanation (2018) 为什么你 应该 使用 Argon2.


也就是说,从 Symfony 5.3 开始,the "auto" password hasher is Bcrypt

所以你可能会想,他们为什么选择 Bcrypt?好吧,如果你看看这个 PR, it links to this tweet (2019),说明以下关于 Argon2 的内容:

It is weaker than bcrypt at runtimes < 1000 ms.

我假设他们(那些审查了 PR 和声明的人)认为这个 statement/person 是可信的,但是 如果这个陈述实际上是正确的并且是否有任何支持这一说法的证据。因此,有关更多信息,您可以查看 this thread (2021)。


看完以上所有内容后,我暂时坚持使用 Bcrypt