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

Adding support for multiple checksum formats for create command #120

Merged
merged 26 commits into from
Mar 14, 2022

Conversation

ptrpfn
Copy link
Collaborator

@ptrpfn ptrpfn commented Feb 17, 2022

mthudgins and others added 16 commits February 10, 2022 16:53
1. Created HashPair to tie a hash string to a hash format
2. Created an aggregate hasher to output multiple hash strings
3. Created functions to create multiple hashes from file or data input
4. Added generator methods to append multiple file and directory hashes
5. Added FIXME comments in commands.py where the need to refactor is suspected
Fixed a bug that was supplying the wrong parameter to the aggregate data hashing method
The functions which generate format hashes can now operate with multiple hashes, however the command signature still needs to be updated to allow for multiple hashes to be supplied via the cli
- enabling multiple=True for -h command line option
- adjusting methods in command.py
- fixing small copy&paste issue (path vs file_path)
- limitation: only works with "-n" option (without directory hashes)
Updated verify_directory_hash_subcommand to handle multiple hash formats

Will pass verification if at least one format can be completely verified.
@ptrpfn ptrpfn marked this pull request as ready for review March 2, 2022 19:23
@ptrpfn
Copy link
Collaborator Author

ptrpfn commented Mar 7, 2022

@mthudgins There is something weird going on in my tests with two hash formats: For example, when you remove the -n option in test_create_mulitple_hashformats, a c4 hasher tries to interpret a md5 hash (and runs out of hex characters). I also tried to run something similar on a folder with ascmhl create -v -h md5 -h sha1 /Users/ptr/Desktop/B002R2EC_temp which also failed. Is there a test that invokes the directory hashing with multiple hash formats successfully? I hope I didn't miss anything.
image

@mthudgins
Copy link
Collaborator

mthudgins commented Mar 7, 2022 via email

@ptrpfn
Copy link
Collaborator Author

ptrpfn commented Mar 8, 2022

I look into this and get back to you

Looks good now! I adjusted a few more tests for directory hashes to also check multiple hash formats and adjusted the stdout output a bit for a cleaner log.

ptrpfn and others added 5 commits March 8, 2022 16:13
run test with "% pytest tests/test_create.py" (test might not work properly from within PyCharm etc. due to path issues to XSD)
hash generation now only generates non-specified existing hash formats if one is needed to benchmark verification
@ptrpfn
Copy link
Collaborator Author

ptrpfn commented Mar 14, 2022

Looks good to me, ready to merge!

@ptrpfn ptrpfn requested a review from mthudgins March 14, 2022 08:49
Copy link
Collaborator

@mthudgins mthudgins left a comment

Choose a reason for hiding this comment

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

final approval for adding support of multiple checksum formats

@mthudgins mthudgins merged commit 32bcb61 into master Mar 14, 2022
@mthudgins mthudgins deleted the dev/multiple-checksum-output branch March 14, 2022 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants