Skip to content

Add FNV-1a hash algorithm implementation with 32-bit and 64-bit variants - #13814

Closed
dinilH wants to merge 2 commits into
TheAlgorithms:masterfrom
dinilH:master
Closed

dinilH wants to merge 2 commits into
TheAlgorithms:masterfrom
dinilH:master

Conversation

@dinilH

@dinilH dinilH commented Oct 30, 2025

Copy link
Copy Markdown

Description

Add FNV-1a (Fowler-Noll-Vo) hash algorithm implementation to the hashes module.

Changes

  • Add hashes/fnv1a.py with two functions:
    • fnv1a_32(): 32-bit FNV-1a hash
    • fnv1a_64(): 64-bit FNV-1a hash

Why this contribution?

  • FNV-1a is a widely-used, fast, non-cryptographic hash function
  • Missing from the current hash algorithms collection
  • Educational value for understanding hash function design
  • Better distribution properties than original FNV-1

Testing

  • ✅ All 20 doctests pass
  • ✅ Tested with various inputs (empty string, single char, long strings)
  • ✅ Verified consistency (same input → same output)
  • ✅ Verified differentiation (different inputs → different outputs)
  • ✅ Type checking with mypy passes
  • ✅ Code style checks with ruff pass

References

@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Oct 1, 2026
@cclauss

cclauss commented Oct 1, 2026

Copy link
Copy Markdown
Member

Clearing all open pull requests to prepare for Hacktoberfest 2026 -- https://hacktoberfest.com

@cclauss cclauss closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants