-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Fast, incremental SHA hashing for bytestrings
--
-- A zero-copy binding to Aaron Gifford's SHA implementation, including a
-- copy of that implementation
@package SHA2
@version 0.2.2
module Codec.Digest.SHA.Misc
-- | Converts a ByteString to hexadeximal string format
showBSasHex :: ByteString -> String
showHex :: Word8 -> String -> String
-- | A primitive interface to SHA-2
module Codec.Digest.SHA.IO
data Length
SHA256 :: Length
SHA384 :: Length
SHA512 :: Length
data SHACtx
newCtx :: Length -> IO SHACtx
-- | Heads up: Calling this function after calling finalizeCtx is likely to
-- result in crashes, therefore unsafe.
unsafeUpdateCtx :: SHACtx -> ByteString -> IO ()
-- | After calling this, you must not call either unsafeUpdateCtx or
-- unsafeFinalizeCtx again. (On the same context)
unsafeFinalizeCtx :: SHACtx -> IO ByteString
-- | Converts a ByteString to hexadeximal string format
showBSasHex :: ByteString -> String
instance Storable Ctx512
instance Storable Ctx384
instance Storable Ctx256
-- | A safe interface to SHA that still lets you digest incrementally
module Codec.Digest.SHA.Monad
type SHA s a = SHAT (ST s) a
type SHAT m a = ReaderT SHACtx m a
data Length
SHA256 :: Length
SHA384 :: Length
SHA512 :: Length
runSHAT :: MonadUnsafeIO m => Length -> SHAT m a -> m (a, ByteString)
runSHA :: Length -> (forall s. SHA s a) -> (a, ByteString)
-- | Hash some data, combining it with everything already hashed in this
-- context
class Hashable a
update :: (Hashable a, MonadUnsafeIO m) => a -> SHAT m ()
-- | Converts a ByteString to hexadeximal string format
showBSasHex :: ByteString -> String
instance Hashable ByteString
instance Hashable ByteString
-- | A pure interface to SHA2
module Codec.Digest.SHA
data Length
SHA256 :: Length
SHA384 :: Length
SHA512 :: Length
-- | Plain SHA2
hash :: Hashable a => Length -> a -> ByteString
-- | SHA2-based HMAC, see http:en.wikipedia.orgwikiHMAC
--
-- If you're doing encryption and want to prevent attackers from changing
-- your messages, you probably want this.
hmac :: Hashable a => Length -> ByteString -> a -> ByteString
-- | Converts a ByteString to hexadeximal string format
showBSasHex :: ByteString -> String