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

as-sha256: support totalLength parameter #276

Open
twoeths opened this issue Jul 24, 2022 · 1 comment
Open

as-sha256: support totalLength parameter #276

twoeths opened this issue Jul 24, 2022 · 1 comment

Comments

@twoeths
Copy link
Contributor

twoeths commented Jul 24, 2022

Is your feature request related to a problem? Please describe.

Some consumers only want first n bytes after calling digest() and they have to use this pattern: digest(something).slice(0, n), note that Uint8Array.slice() returns a copy of the array so it's not efficient

Describe the solution you'd like

Add an optional totalLength parameter to digest() methods so it requires only 1 memory allocation

@wemeetagain
Copy link
Member

I don't think this is necessary since Uint8Array.subarray is also available.

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

No branches or pull requests

2 participants