Skip to content
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

Allow optional use of Node Buffers. #811

Merged
merged 1 commit into from
Jan 1, 2021
Merged

Allow optional use of Node Buffers. #811

merged 1 commit into from
Jan 1, 2021

Conversation

techhead
Copy link
Contributor

@techhead techhead commented Jun 8, 2020

The hash(Sync) and compare(Sync) methods will now accept data as a string or Buffer.

Also removed a few extraneous string copy operations.

@recrsn
Copy link
Collaborator

recrsn commented Jun 8, 2020

We would need Buffer support in async as well, async is the most widely used mode.

Thanks for your contribution

@techhead
Copy link
Contributor Author

techhead commented Jun 8, 2020

We would need Buffer support in async as well, async is the most widely used mode.

Thanks for your contribution

Yes, both modes are included, hash/hashSync, compare/compareSync. That's what the parenthesis were supposed to indicate. Sorry that wasn't more clear.

@flintinatux
Copy link

Are there any other concerns about this PR? Would be great to have support for Buffers.

I landed here looking for a solution to bcrypt-ing passwords longer that 72 bytes. One way to do so is to get the sha512 digest of the password, and then pass the digest to bcrypt. However, converting that digest to a String causes it either to go over 72 bytes or to run the risk of getting null characters. If I can leave it as a Buffer before passing to bcrypt that would be optimal.

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.

None yet

3 participants