Add FILE_SHA256 predicate - #369
Open
4Luke4 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add a new
FILE_SHA256 fileName sha256sumpatch-expression predicate as a cryptographically reliable counterpart toFILE_MD5.FILE_SHA256through the AST, evaluator, diagnostic formatter, legacy lexer/parser, and Elkhound grammar.falsefor missing files.FILE_SHA256in the canonical TeX reference and the WeiDU changes file.FILE_MD5documentation to state that MD5 is cryptographically unreliable and strongly encourage mod authors to useFILE_SHA256for new checksum checks.Design
The implementation does not invoke platform-specific checksum utilities and does not add an external OCaml package or runtime dependency.
Files are read in bounded chunks rather than loaded wholly into memory. Input channels are closed on both successful and exceptional paths.
FILE_SHA256follows the established behavior ofFILE_MD5:false.Documentation
The canonical
doc/base.texreference now documents:FILE_SHA256 fileName sha256sum.FILE_SHA256for new checksum checks.Validation
hashlib.sha256for inputs of 0, 1, 3, 55, 56, 63, 64, 65, 127, 128, 129, 65,535, 65,536, 65,537, and 1,000,000 bytes.makeon Ubuntu 22.04 from the proposed implementation commit.git diff --checksuccessfully.