Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Generic, low-level data types for hashing. This is an internal module.
You should only import this module if you write your own hash algorithm
or if you need access to low-level hashing functions when defining
instances of LargeHash
.
Regular users should not import this module. Import LargeHashable
instead.
Synopsis
- data HashUpdates = HashUpdates {
- hu_updatePtr :: !(Ptr Word8 -> Int -> IO ())
- hu_updateUChar :: !(Word8 -> IO ())
- hu_updateUShort :: !(Word16 -> IO ())
- hu_updateUInt :: !(Word32 -> IO ())
- hu_updateULong :: !(Word64 -> IO ())
- data HashAlgorithm h = HashAlgorithm {
- ha_run :: !((HashUpdates -> IO ()) -> IO h)
- ha_xor :: !(h -> h -> h)
- ha_updateHash :: !(HashUpdates -> h -> IO ())
- data LH a
- hashUpdates :: LH HashUpdates
- ioInLH :: IO a -> LH a
- runLH :: HashAlgorithm h -> LH () -> h
- updateXorHash :: [LH ()] -> LH ()
Documentation
data HashUpdates Source #
Functions for updating an intermediate hash value. The functions live
in the IO
monad because they are typically implemented via FFI.
HashUpdates | |
|
data HashAlgorithm h Source #
The interface for a hashing algorithm. The interface contains a simple run function, which is used to update the hash with all values needed, and the outputs the resulting hash.
HashAlgorithm | |
|
The LH
monad (LH
stands for "large hash") is used in the definition of
hashing functions for arbitrary data types.
ioInLH :: IO a -> LH a Source #
Perform an IO
action in the LH
monad. Use with care, do not perform
arbitrary IO
operation with this function! Only use it for calling
functions of the HashUpdates
datatype.
runLH :: HashAlgorithm h -> LH () -> h Source #
Runs a LH
computation and returns the resulting hash.
updateXorHash :: [LH ()] -> LH () Source #