OpenHFT / OpenHFT/Zero-Allocation-Hashing

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

Open
#83 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

review
Dominant language
Java
Stars
845
Forks
140
Avg merge
12d 38m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Begin by locating the Java hashing APIs that accept byte arrays and compare their allocation behavior; done would require a decided zero-allocation approach for byte[][] and validation of its resulting hash.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.