Correct the FNV-1a 64-bit offset basis and assert known hash outputs
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- compilers, testing-qa
Research direction
Read std/string/hash.wave at the cited initialization and tests/cases/shared/test81.wave at the existing hash check. Run the relevant shared test, then add exact checks for the empty string, a single ASCII byte, and a longer string, verifying the 64-bit bit patterns and intentional modulo-2^64 behavior. Done means the known FNV-1a outputs pass without adding dependencies.
Written by the indexing model from the issue text.
Description
fnv1a_64 initializes its hash with 1469598103934665603, which differs from the FNV-1a 64-bit offset basis 14695981039346656037 (0xCBF29CE484222325). The empty string already exposes the difference: the loop is skipped, so the function returns the incorrect seed. Nonempty hashes consequently do not interoperate with FNV-1a implementations.
The existing shared/test81 check only requires a nonzero result, which cannot catch a wrong algorithm constant. The correct bit pattern exceeds positive i64, so a fix must also handle unsigned arithmetic/result representation deliberately.
Code evidence:
Acceptance:
- Use the correct 64-bit offset basis and intentional modulo-2^64 multiplication, preserving the existing public result type unless a separately reviewed API change is needed.
- Add exact known-output checks for the empty string, a single ASCII byte, and a longer string; compare the 64-bit bit pattern rather than assuming a positive signed result.
- Keep the implementation dependency-free and note that correcting this bug changes previously computed hashes.
Reference: FNV offset basis values, RFC 9923 section 5. This is a small constant/arithmetic and regression-test contribution.
Audit status: static source inspection against canonical master ea74c2dafc31da876e5561f2d176ba719f5a0458 on 2026-09-10. No compiler build, test execution, implementation change or local reproduction was performed for this report. The examples describe the source-derived behavior to verify when implementing the fix.
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 6m
- Merged PRs (30d)
- 44
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wavefnd/Wave
-
ci enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
documentation good first issue needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
good first issue needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
good first issue needs testing
Difficulty 2/5 Half a day Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100