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

How to correctly calculate hash for byte[][]? #83

Open
ruslangm opened this issue Nov 15, 2023 · 0 comments
Open

How to correctly calculate hash for byte[][]? #83

ruslangm opened this issue Nov 15, 2023 · 0 comments

Comments

@ruslangm
Copy link

ruslangm commented Nov 15, 2023

In standard hash functions in Java we can do something like:

Digest digest = new Blake2bDigest(64);
for (int i = 0; i < bytes[0].length; i++) {
	digest.update(bytes[0][i], 0, bytes[0][i].length));
}
byte[] hash = new byte[digest.getDigestSize()];
digest.doFinal(hashResult, 0);
return hash;

I understand that it's not possible to have similar API here since the main goal of this project is to have zero allocations. But what will be the correct way to calculate result hash for an array of arrays? Is there any solution except creating one big byte array and put everything into it?
Thanks.

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

1 participant