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

"caches" successful hash algorithms for a given checkfile #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shawnbayern
Copy link

The goal, based on a sort of principle of locality (or just the typical way checkfiles are generated), is to improve real-world performance by inferring the correct hash algorithm based on previous successes in the same run. I imagine in most cases there will be exactly one successful algorithm per checkfile, but this implementation supports arbitrarily many.

I've tried to make the minimal changes to the existing code necessary to achieve this; integrating in that way always makes the code feel potentially a little messy to me, but it also seems the most friendly way to offer changes. I tried to preserve the existing style even when it didn't match my own. Because of the bitwise markers used to manage the hash-check routines in the existing code, I didn't see an immediately obvious cleaner way to perform the kind of "caching" I wanted to perform.

I'm not sure if anyone needs this, but the use case I have in mind is a checkfile generated in the typical way by rhash or a program that supports a singular algorithm (sha512sum or whatever). Run over large files or many files, it is potentially quite wasteful to walk through every algorithm for a particular size of a message digest.

See also #256.

The goal, based on a sort of principle of locality (or just the
typical way checkfiles are generated), is to improve real-world
performance by inferring the correct hash algorithm based on
previous successes in the same run.  I imagine in most cases
there will be exactly one successful algorithm, but this
implementation supports arbitrarily many.

Signed-off-by: Shawn Bayern <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants