Skip to content

Feature to remember successful hash algorithm when checking file #256

Open
@sjb2024

Description

@sjb2024

Hi there. In version 1.4.1, you added a feature to "speed up" verification by detecting the hash algorithm from filenames.

Given that it's most common for the hashes in a file to come from a single algorithm (e.g., because the checkfile is output from singular program like sha256sum, sha512sum, or rhash itself with a single hash), a similar way to "speed up" verification in practice would be to provide an option (or perhaps even make it the default) to "learn," in each separate run of rhash -c, which algorithm has been successful for a checkfile and remember that for the remainder of the run. I don't mean that anything should persist past the run of rhash -c, just that internally rhash favor hash algorithms that have previously succeeded for a given checkfile.

I think the ideal behavior might be simply to reorder the default search order of the hashing algorithms so that the previously successful one(s) are tried first, given a hash of a particular length to be verified in a checkfile; this should do no harm and speed up verification in the most common case.

Perhaps it would also be useful to provide an option that requires hashes within a checkfile to come consistently from the same source, whatever it might be, but I'm not sure how often that would be used. Still, I would use such an option over the current default behavior (given that I have many checkfiles that (1) do not always carry useful names but (2) contain long lists of hashes, all from the same algorithm). The only alternative, if I want optimal performance, is to figure out what the hashes are myself and then supply that algorithm to rhash manually.

Thanks for considering this feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions