iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.ByteString.RollingHash

Synopsis

Documentation

rollingHash :: ByteString -> RollingHash 2047 Source #

rollingHash == rollingHashWith 2047
>>> import qualified Data.ByteString.Char8 as C
>>> rollingHash $ C.pack "abc"
406650978
>>> rollingHashWith @2047 $ C.pack "abc"
406650978

rollingHashWith :: forall b. KnownNat b => ByteString -> RollingHash b Source #

b should be a primitive root of (2^61-1)

>>> import qualified Data.ByteString.Char8 as C
>>> isPrimitiveRootRH 123
True
>>> rollingHashWith @123 $ C.pack "abc"
1479666