https://github.com/thevilledev/chibihash-hs
ChibiHash in Haskell - a small, fast 64-bit hash function
https://github.com/thevilledev/chibihash-hs
hash-functions haskell-library
Last synced: 4 months ago
JSON representation
ChibiHash in Haskell - a small, fast 64-bit hash function
- Host: GitHub
- URL: https://github.com/thevilledev/chibihash-hs
- Owner: thevilledev
- License: mit
- Created: 2024-11-26T21:16:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-03T05:58:34.000Z (over 1 year ago)
- Last Synced: 2025-12-01T17:27:48.850Z (6 months ago)
- Topics: hash-functions, haskell-library
- Language: Haskell
- Homepage: https://nrk.neocities.org/articles/chibihash
- Size: 21.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ChibiHash-hs
[
](https://hackage.haskell.org/package/ChibiHash)
Haskell port of [N-R-K/ChibiHash](https://github.com/N-R-K/ChibiHash). See the article [ChibiHash: A small, fast 64-bit hash function](https://nrk.neocities.org/articles/chibihash) for more information.
All credit for the algorithm goes to [N-R-K](https://github.com/N-R-K).
## Usage
This package supports both versions of the algorithm.
By default, the v1 version is used.
To use the v2 version, you need to import it explicitly.
```haskell
module Main (main) where
import ChibiHash (chibihash64) -- v1 by default
import qualified ChibiHash.V2 as V2 -- v2 explicitly
import qualified Data.ByteString.Char8 as C8
main :: IO ()
main = do
let text = "Hello, ChibiHash!"
putStrLn $ "Input text: " ++ show text
putStrLn $ "Hash (seed 0): " ++ show (chibihash64 (C8.pack text) 0)
putStrLn $ "Hash (seed 42): " ++ show (chibihash64 (C8.pack text) 42)
```
You may also run the example program with `cabal run`.
## Tests
Run tests with `cabal test`. Both v1 and v2 are tested.
## License
MIT.