-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong hashes when characters outside of ISO 8859-1 are used #126
Comments
Hi @GisoBartels, can you provide a working example for this issue? |
Sure. I noticed the problem through a failing test in an update PR. See here: GisoBartels/kaster#8 |
From what I see the PR is failing because of a test about password generation not password hashing.
I don't see Password4j involved in that test. Please report here a piece of code where Password4j is involved, with input, output and expected output (from external tools if needed). I'm not going to analyze and debug third party libraries 😞 In Have you tried to convert strings to bytes with a different encoding? Password4j accepts also Password4j.hash("my password".getBytes(StandardCharsets.UTF_8)).with(...); |
I created a test, so you can debug for yourself. The test will go green, when the default charset is set to UTF-8 |
Hi @GisoBartels thank you for providing a working example. In the next days I will publish the fix for the issue. This might impact other projects but I think that very few people uses non-ASCII characters for their passwords. |
#126: back to UTF-8 encoding for byte[]
Hi @GisoBartels |
Thanks for fixing quickly 😊 |
Describe the bug
Since v1.7 the default encoding was changed from UTF-8 to ISO 8859-1.
When hashing strings with characters not supported by ISO 8859-1, they get replaced by the
?
character, leading to incorrect hashes.To Reproduce
Hash a string with unsupported characters (e.g.
’
) with both v1.6.x and v1.7.x with different results.Expected behavior
Hashes don't differ for different versions.
The text was updated successfully, but these errors were encountered: