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

Avoid copy of memory for state changes by using .subarray() #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vipertechofficial
Copy link

Used subarray method whenever possible and added a method to reset the object, enabling the same object to be reused properly.

Used subarray method whenever possible and added a method to reset the object, enabling the same object to be reused properly.
@jungomi jungomi changed the title Update index.js Avoid copy of memory for state changes by using .subarray() Oct 12, 2023
@jungomi
Copy link
Owner

jungomi commented Oct 12, 2023

Thanks, avoiding a copy is always nice 👍

For the reset, as we based the streaming interface on the API of Hash from the Node.js crypto module, there is no way to reset it and it is expected to create a new Hasher for it.
I can see the interest in having it, but if it should be added, that requires writing extensive tests for it, change the type definitions in types.d.ts and include that information in the README. So I would suggest to move the reset functionality to a separate PR, if that's really something that should be added, and keep this PR just for the subarray change.

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

2 participants