Skip to content

Conversation

apollo13
Copy link
Member

Argon2 encodes the salt as base64 for representation in the final hash
output. To be able to accurately return the used salt from decode we
now b64decode it and decode from latin1 (for the remote possibility that
someone supplied a custom hash consisting solely of bytes -- this would
require a manual construction of the hash though, Django's interface
does not allow for that).

I ran into this while working on #12553 just now.

@apollo13
Copy link
Member Author

I have pushed a followup commit which uses decode in must_update like the other hashers do. This will give #12553 access to the needed salt then.

Argon2 encodes the salt as base64 for representation in the final hash
output. To be able to accurately return the used salt from decode(),
add padding, b64decode, and decode from latin1 (for the remote
possibility that someone supplied a custom hash consisting solely of
bytes -- this would require a manual construction of the hash though,
Django's interface does not allow for that).
@felixxm felixxm changed the title Properly return salt of argon2 hashes in decode/safe_summary. Refs #31358 -- Fixed decoding salt in Argon2PasswordHasher. Dec 28, 2020
Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apollo13 Thanks 👍

@felixxm felixxm merged commit c76d51b into django:master Dec 28, 2020
@apollo13 apollo13 deleted the argon2_summary branch May 8, 2022 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants