This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
#65: Replace CRC32
with BLAKE3
Hash Function
#73
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces a new benchmark file, benches/hash_benchmark.rs. The file includes the compute_bytes_benchmark function, which has three benchmarks for different use cases: - compute_bytes_small: Benchmarks with small input data. - compute_bytes_medium: Evaluates medium-sized input data. - compute_bytes_large: Measures large input data performance. criterion is configured as a dev dependency with the html_reports feature for detailed HTML reports in target/criterion/. Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit includes the following changes: - Update the hashing method in the ResourceId struct from crc32fast to blake3 - Due to the change in hash representation, ResourceId no longer implements Copy but remains Clone. - Adjust code throughout arklib to accommodate the new hashing method. - Update tests that utilize ResourceId to reflect the changes. There will be a follow up commit to remove the collision counter from the code since Blake3 is a cryptographic hash function Signed-off-by: Tarek <tareknaser360@gmail.com>
The hash function was updated from crc32 to blake3 in the previous commit. This commit removes references to collisions from the code, as Blake3 is a cryptographic hash function and does not produce collisions. Signed-off-by: Tarek <tareknaser360@gmail.com>
Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit updates the storage format of the BLAKE3 hash in the ResourceId struct from a hex-encoded string to a fixed-size array [u8; 32]. Storing the hash as a byte array eliminates the need for hex decoding and encoding operations, potentially improving performance. Signed-off-by: Tarek <tareknaser360@gmail.com>
Let's finish the benchmarks first: After we have index benchmark, we'll be able to judge better about performance penalty of Blake3. Collision tracking, necessary for CRC32, could eat some performance up, too. |
kirillt
reviewed
Jan 28, 2024
kirillt
reviewed
Jan 28, 2024
kirillt
reviewed
Jan 28, 2024
This commit improves readability for ResourceId struct by base64 encoding the blake3 hash for printing and parsing. It also removes data_size field from ResourceId and removes its references from other parts of the code Signed-off-by: Tarek <tareknaser360@gmail.com>
CRC32
with BLAKE3
Hash FunctionCRC32
with BLAKE3
Hash Function
This PR should be rewritten when #90 is merged here and into I can re rewrite the logic in |
Closing this in favor of ARK-Builders/ark-core#32 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request updates the hashing method for the
ResourceId
struct, replacingCRC32
withBLAKE3
hash function.Related Issue: #65
Changes
The changes include:
ResourceId::compute_bytes
method using thecriterion
crate with thehtml_reports
feature enabled. Runcargo bench
to generate benchmarks in the/target/criterion
folderBLAKE3
is a cryptographic hash function