Skip to content

Conversation

PaintNinja
Copy link
Contributor

@PaintNinja PaintNinja commented Sep 22, 2025

I did this a while back and forgot about it, whoops!

Needs testing and review before merging.

  • Add CRC32 support (closes [Hash Utils] CRC32 support #2)
  • Add Alder32 support
  • Avoided BigInteger
  • Faster loading and saving of the HashStore
  • Avoided conversions to and from Latin1 <=> UTF-8 for hex chars

@PaintNinja PaintNinja added the enhancement New feature or request label Sep 22, 2025
@Jonathing
Copy link
Member

Not gonna require it for approval, but a chart/comparison of this in Mavenizer would be helpful to visualize the gains.

HashFunction func = functions[x];
MessageDigest digest = digests[x];
ret[x] = func.pad(new BigInteger(1, digest.digest()).toString(16));
ret[x] = functions[x].hash(file);
Copy link
Member

Choose a reason for hiding this comment

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

This was actually explicitly written this way because the disc IO is the main concern when hashing files. Doing it this way makes things a lot slower because the entire file needs to be read for each hash function, instead of once.

Copy link
Member

@Jonathing Jonathing left a comment

Choose a reason for hiding this comment

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

As discussed on Discord, please re-work this PR using static getter methods instead of adding more public API.

https://discord.com/channels/1129059589325852724/1129095235889270844/1419795694625099866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hash Utils] CRC32 support

3 participants