Repository navigation
hash: Hash.siphash, SipHash in C with any round count and a 64- or 128-bit tag - #2605
Merged
Merged
Conversation
…t tag SipHash-2-4 by default; SipHashOptions picks the rounds and a 16-byte tag, as zig's build cache keys its manifests (SipHash128-1-3), which ci/cosmic_ci reads in Lua until the driver pin carries this. Checked against zig's std.crypto.auth.siphash at every tail length. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
Review: an Example.siphash rather than an `allowed` entry, the Lua SipHash in ci/cosmic_ci/zig_prune.tl marked for the driver pin, test lengths reaching a 3-byte tail and a wrapped length byte (257), and the function's comment above the function. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
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.
Adds
Hash.siphash(key, data, options?)tocosmic.hash, a C binding (hash_siphashincore/hash.c) following SipHash's reference implementation:Hash.SipHashOptionspicks the compression and finalization rounds (1 to 64) and a 16-byte tag (SipHash-128).Why: zig's build cache keys its manifests with SipHash128-1-3, and
ci/cosmic_ci/zig_prune.tl(and the CI restat step to follow) recompute those keys. They do it in pure Lua at about 6 MB/s. CI's driver runs on the releaseci/cosmic-driver.pinnames, so it can use this only once the pin moves. ATODO:at the Lua SipHash marks the switch.Verification
cosmic/hash_test.tlchecks SipHash64 2-4, SipHash128 2-4, SipHash128 1-3 and SipHash64 1-3 at lengths 0, 1, 3, 7, 8, 15, 16, 63 and 257. That covers word tails of 0, 1, 3 and 7 bytes, and the length byte wrapping past 255. Key and message follow the reference vectors' scheme. Tags come from zig'sstd.crypto.auth.siphash; the first SipHash-2-4 tag,310e0edd47db6f72, is the paper's own.Example.siphashincosmic/hash_example.tl.o/bin/cosmic test(3521 pass),fix --check .,ci/'sfix --check,bin/zig build analyzeandbin/zig build sanitizedall pass. The hash tests also pass on the sanitized core.Review
A separate agent compared 144 tags against zig's: SipHash64 2-4/1-3/4-8, SipHash128 2-4/1-3/3-1, and lengths 0 to 70000. All matched, and it found no argument-handling or C-rule issue. Its findings and what was done:
allowedentry rather than an example. Replaced byExample.siphash.TODO:at the Lua SipHash the driver will replace. Added.TODOs
ci/cosmic_ci/zig_prune.tl:89. Hash withHash.siphash's SipHash128-1-3 rather than in Lua, onceci/cosmic-driver.pinnames a release that carries it.🤖 Generated with Claude Code
https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
Generated by Claude Code