Skip to content

Truncate secrets greater than 72 chars in hash_secret - #255

Merged
tenderlove merged 6 commits into
bcrypt-ruby:masterfrom
asavageiv:alan/long-passwords
Nov 30, 2021
Merged

tenderlove merged 6 commits into
bcrypt-ruby:masterfrom
asavageiv:alan/long-passwords

Conversation

@asavageiv

Copy link
Copy Markdown
Contributor

Fixes #225

@asavageiv asavageiv changed the title Truncate secrets greater than 255 chars in hash_secret Truncate secrets greater than 72 chars in hash_secret Jul 7, 2021

@tjschuck tjschuck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this PR! One technical issue, though: bcrypt truncates secrets at 72 bytes, not characters, so this probably isn't correct outside of the 1-byte character space.

@asavageiv

Copy link
Copy Markdown
Contributor Author

Great catch! Updated to truncate based on bytesize instead and added a test for that.

@asavageiv
asavageiv requested a review from tjschuck July 8, 2021 16:31
Comment thread spec/bcrypt/password_spec.rb Outdated
@asavageiv
asavageiv requested a review from tjschuck July 8, 2021 22:27
@asavageiv

Copy link
Copy Markdown
Contributor Author

friendly ping

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.

InvalidHash on Ubuntu 20.04

3 participants