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

feat: blake3_2to1AsU8a, add 2-to-1 blake3 Hash Function #32

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

jonathanxuu
Copy link
Collaborator

feat(blake32to1AsU8a): add 2-to-1 blake3 Hash Function

This function offers a new 2-to-1 blake3 function, which do padding and iterative blake3 hash as described below:

  • If bitLength is not 256 by default, this function will get the same result as blake3AsU8a from @zcloak/crypto.
  • If bitLength is 256, then this function will do the following things:
    • If the Uint8Array input's length is less than 32, we will padding it to 32 bytes, and will not perform blake3.
    • If the Uint8Array input's length is 33-64 bytes, we will padding it to 64 bytes, and do one-time blake3.
    • If the Uint8Array input's length is 64-96 bytes, we will padding it to 96 bytes, and do blake3 for the first 64 bytes, and generate a 32-byte result; Then, concat the '32-bytes hash result' with the remain 32 bytes, do another blake3;

So, this function will automatically do padding and iterative blake3 hash for the Uint8Array input.

@zzcwoshizz zzcwoshizz merged commit 6e3a0a4 into zCloak-Network:master Jan 19, 2023
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