Skip to content

feat(hash): port mumbo to Starlark (hash.mumbo) - #257

Merged
helly25 merged 3 commits into
mainfrom
feat/hash-mumbo-bzl
Jul 13, 2026
Merged

feat(hash): port mumbo to Starlark (hash.mumbo)#257
helly25 merged 3 commits into
mainfrom
feat/hash-mumbo-bzl

Conversation

@helly25

@helly25 helly25 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Adds hash.mumbo to the Starlark ports in //mbo/hash:hash.bzl, next to hash.dumbo / hash.fnv1a, as requested.

What

  • Port mumbo::GetHash64 (the default 64-bit hash) to Starlark: the kSecret bank, seed absorb, the <=16-byte small-key loader, the 16-byte MUM chain, the 8-lane 128-byte bulk tier, and the two-multiply finalizer — all as masked 64-bit arithmetic (Starlark has no while, so the loops are bounded ranges with the same break condition, matching the existing dumbo port).
  • Only the one-shot 64-bit form is ported; the native 128-bit jumbo and streaming stay C++-only.
  • hash.mumbo's default seed is the library-wide kDefaultSeed (5381) — distinct from dumbo (0) and fnv1a (the FNV offset basis). Documented in the README along with how to pass a seed (optional second arg).
  • Wire mumbo into the bzl-vs-C++ verify (_FNS + default algos); hash_tool already registered mumbo. Update the Algorithm-overview Starlark column.

Verification

  • //mbo/hash:hash_bzl_vs_cpp_mumbo_test passes: the Starlark output is byte-for-byte identical to the hash_tool C++ prime across lengths 0..300 (small <=16, medium 17..127, and bulk >=128 tiers, plus every tail size) and the extra strings. dumbo/fnv1a still pass.
  • The generated SMHasher3 Results table is unaffected (quality --check green); the only overview-table change is mumbo's Starlark flag.

Independent of #256 (touches hash.bzl + README, not the measurements package).

helly25 added 3 commits July 12, 2026 23:41
Port the default 64-bit hash mumbo::GetHash64 to hash.bzl next to dumbo/fnv1a:
the kSecret bank, the seed absorb, the small-key (<=16) loader, the 16-byte MUM
chain, the 8-lane 128-byte bulk tier, and the two-multiply finalizer - all as
masked 64-bit Starlark arithmetic. Its default seed is the library-wide
kDefaultSeed (5381), unlike dumbo (0) and fnv1a (offset basis).

Verified byte-for-byte against the C++ prime via hash_bzl_vs_cpp_mumbo_test
(hash_tool already registered mumbo), across lengths 0..300 spanning all three
tiers and every tail size. Only the one-shot 64-bit form is ported; the native
128-bit jumbo and streaming stay C++-only. Updates the Algorithm-overview
Starlark column and documents each port's canonical default seed.
# Conflicts:
#	CHANGELOG.md
#	mbo/hash/README.md
@helly25
helly25 enabled auto-merge (squash) July 13, 2026 18:13
@helly25
helly25 requested a review from Fab-Cat July 13, 2026 18:14
@helly25
helly25 merged commit b372765 into main Jul 13, 2026
22 checks passed
@helly25
helly25 deleted the feat/hash-mumbo-bzl branch July 13, 2026 18:49
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