(#747) Switch CryptoHashProvider to filestream for hashing files #2714
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 Of Changes
This changes the
hash_file
method to use a filestream which is passed to ComputeHash, whichshould allow arbitrary file sizes with better memory usage.
The unit test for this method had to be removed because the mock
filesystem does not allow opening a file stream.
Motivation and Context
Previously, when getting the checksum of a file, this read the file
into a byte array to pass to ComputeHash. However, this was limited to
files of 2gb or less, and was not efficent memory wise.
Testing
Ran integration and units tests.
Validated that the warning/error about the file being too large was resolved this way:
.nupkg
over 2gb.\choco.exe install davinci-resolve -s . --verbose --debug --skippowershell
.chocolatey\davinci-resolve\.files
and validated that the.nupkg
had the correct md5 checksum recorded.Change Types Made
Related Issue
Fixes #747
Change Checklist