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

BLAKE3 hash support #994

Merged
merged 1 commit into from
Jul 1, 2021
Merged

BLAKE3 hash support #994

merged 1 commit into from
Jul 1, 2021

Conversation

jeremyBanks
Copy link
Contributor

@jeremyBanks jeremyBanks commented Jun 30, 2021

BLAKE3 is a performant and versatile hash function. It's the successor to the well-studied BLAKE2 family of hashes. I'd like to use for some projects, and I think could make a nice addition to the standard library.

If there is interest, here is a PR which adds it to std/hash via the official Rust implementation. (Per #658 it looks like we wouldn't want to also include a TypeScript implementation.)

I'm not sure if this is redundant with the ongoing work on WebCrypto. However, the WebCrypto specification seems to only include SHA-1 and SHA-2-family digests, so perhaps this implementation would still be useful until/unless a "blake3" option is added to that specification.


Adds support for the BLAKE3 hash function to std/hash.

This uses the official blake3 Rust crate, via the hash/_wasm/wasm.js bundle.
No TypeScript implementation is included.

This includes only the primary BLAKE3 function with its default 256-bit output length.
This does NOT expose its secondary modes or support for variable-length output.

Test cases were generated using the official b3sum CLI.
For example, for testSetBase64.blake3.millionAs:

printf "%1000000s" | tr " " "a" | b3sum --no-names --raw - | base64 --wrap=0

@CLAassistant
Copy link

CLAassistant commented Jun 30, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

Great! LGTM

Can you also update 'supported algorithms' section in hash/RAEDME.md?

This uses the official blake3 Rust crate, via the hash/_wasm/wasm.js bundle.
No TypeScript implementation is included.

This includes only the primary BLAKE3 function with its default 256-bit output length.
This does NOT expose its secondary modes or support for variable-length output.

Test cases were generated using the official b3sum CLI.
For example, for testSetBase64.blake3.millionAs:

    printf "%1000000s" | tr " " "a" | b3sum --no-names --raw - | base64 --wrap=0
@jeremyBanks
Copy link
Contributor Author

@kt3k Thanks, done.

@jeremyBanks jeremyBanks requested a review from kt3k July 1, 2021 05:14
@kt3k
Copy link
Member

kt3k commented Jul 1, 2021

@jeremyBanks Thank you for your contribution!

@kt3k kt3k merged commit f4496b7 into denoland:main Jul 1, 2021
@jeremyBanks jeremyBanks deleted the blake3 branch July 1, 2021 05:27
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.

3 participants