fix: use FNV-1a hash for Node-based Claude installs (Windows npm)#8
Merged
Merged
Conversation
Claude Code's companion hash function has a runtime branch: - Under Bun: uses Bun.hash (wyhash) - Under Node: uses FNV-1a On Windows npm installs, Claude Code runs via `node cli.js`, not Bun. The finder was always using Bun.hash to brute-force salts, producing salts that give the wrong pet when Claude actually runs under Node. This fix: - Detects if the Claude binary is a .js file (Node runtime) - Uses FNV-1a in the finder worker when targeting Node installs - Runs the worker under Node (not Bun) for FNV-1a mode - Makes Bun optional for Node-based installs - Passes useNodeHash through generation.mjs and tui.mjs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Ah okay, I think i'm going to remove bun a dependency and just try to do the hasing all in node I was just lazy and wanted to reuse bun hash but it seems like they don't always use that? Thank you for this tho its very helpful. planning on tackling this tonight |
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
node cli.js(not Bun). The companion hash function has a runtime branch —Bun.hash(wyhash) under Bun, FNV-1a under Node. The finder was always usingBun.hash, so salts it found produced the wrong pet when Claude actually ran under Node..js/.mjsbinaries as Node runtime and uses FNV-1a for salt brute-forcingChanges
patcher.mjs: AddedisNodeRuntime()detectionfinder-worker.mjs: Added--fnv1aflag to use FNV-1a instead ofBun.hashfinder.mjs: Detects Node runtime, passes--fnv1a, runs worker under Node instead of Bungeneration.mjs: AddeduseNodeHashoption tohashString()androll()preflight.mjs: Bun check is now skipped for Node-based installstui.mjs: Passes runtime detection through to finder and generationTest plan
isNodeRuntime()correctly identifies.jsand.mjsfilesroll()withuseNodeHash: truematches Claude Code's actual output under Node🤖 Generated with Claude Code