Password4j/password4j

Commit for issue #64 erroneously removed "$s0" prefix from scrypt hash strings

dpatriarche opened this issue · 2 comments

Describe the bug

The commit for issue #64 erroneously removed the "$s0" prefix from scrypt hash strings. The "$s0" prefix is present in the hash string generated by the original lambdaworks scrypt library's SCryptUtil.scrypt() function (from package: "com.lambdaworks:scrypt:1.4.0"). From the lambdaworks scrypt library's README.md, the "$s0" prefix indicates "version 0 of the format with 128-bit salt and 256-bit derived key".

To Reproduce

Using the scrypt library, call com.lambdaworks.crypto.SCryptUtil.scrypt() with any values for parameters passwd, N, r, and p. The returned hash string will have the "$s0" prefix.

Expected behavior

Password4j's scrypt hash strings should have the same format as hash string generated by the lambdaworks scrypt library, which includes the "$s0" prefix.

Environment:

  • OS: Any
  • JDK Any
  • Version 1.6.0

Additional context

Hello @dpatriarche,

The s0 is not part of the standard but something invented by the guy that developed the scrypt library and that lambdaworks uses.
The problem with lambdaworks is that it is an homemade archived library.
For example passlib for Python and Spring Security are not affected by this issue.
PS: I'm on vacation, so I'm not able to do further checks and I may remember things differently than they are. So feel free to correct me 😃 🍹

Hi David -- Thank you for the explanation. I'll add a comment to issue #64 for anyone else who runs across this issue migrating a password database created using lambdaworks scrypt to password4j.