urbit-hob

Haskell utilities for phonetic base wrangling.
Log | Files | Refs | README | LICENSE

commit 1120754e3b178bb17debe529a4f4da3372ba7d89
parent 18605a02cc87cef0e28257027d0d7dbc479cd2c3
Author: Jared Tobin <jared@jtobin.io>
Date:   Fri,  6 Sep 2019 04:56:30 -0230

muk: add module

'Muk' implements a particular version of a simple murmur3 hash.

Diffstat:
Asrc/Muk.hs | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/Muk.hs b/src/Muk.hs @@ -0,0 +1,18 @@ +{-# OPTIONS_GHC -Wall #-} + +module Muk ( + muk + ) where + +import Data.Bits +import qualified Data.ByteString.Char8 as B8 +import Data.Char +import Data.Word (Word32) +import qualified Data.Hash.Murmur as M + +muk :: Word32 -> Word32 -> Word32 +muk syd key = M.murmur3 syd kee where + kee = chr lo `B8.cons` chr hi `B8.cons` mempty + lo = fromIntegral (key .&. 0xFF) + hi = fromIntegral (key .&. 0xFF00 `div` 256) +