The package hash is the builtin, and take twill 1.12.0 - #5
Merged
Merged
Conversation
docs/needs.md entry 13 asked for a sha256 builtin and settled on std/hash, which is SHA-256 interpreted one 32-bit word at a time. twill 1.11 has the builtin, held to std/hash by a test in twill over every message length from 0 to 70 bytes. hash_tree calls it now. Measured with mono_ns: 16 MB in 6.5 ms, where std/hash took 0.69 s for 65536 bytes on the same machine. tests/sha256_test.tw checks the published vectors through sha256, which is the function spool calls, and keeps std/hash for padded_len. The README's install block still said 1.7.0 was enough and pointed at the v1.8.0 asset, which was stale against the 1.9.0 pin and is wrong against this one. The pin, the README and CI move to 1.12.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What was wrong.
src/pkghash.twhashed a vendored tree throughstd/hash, SHA-256 run one 32-bit word at a time in the interpreter, about 100 kB/s on this machine.docs/needs.mdentry 13 asked for a builtin and recordedstd/hashas the answer. The README's install block also said twill 1.7.0 was enough and pointed at the v1.8.0 asset, which was already stale against the 1.9.0 pin.What changed.
hash_treecalls twill 1.11'ssha256builtin, the same digest asstd/hashand held to it in twill by a test over every message length from 0 to 70 bytes. Thestd/hashimport inpkghash.twis gone.tests/sha256_test.twchecks the seven published vectors throughsha256, which is now the function spool calls, and keepsstd/hashforpadded_len. README, needs entry 13 and the CHANGELOG say what is true now; the pin, the README install block and CI move to 1.12.0.How verified. On twill 1.12.0 built from
twill/twillmain:twill test testsgives 6 passed, 0 failed;twill checkpasses on every.twfile; the em dash gate is clean. Timed withmono_nson one machine: builtin 16 MB in 6.5 ms;std/hash65536 bytes in 0.69 s. The million-a vector was not added: the builtin hashes it in 0.3 ms buts.repeattakes 21 s to build it, and the comment in the test says so.🤖 Generated with Claude Code