-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Skein, a family of cryptographic hash functions.  Includes Skein-MAC as well.
--   
--   Skein (<a>http://www.skein-hash.info/</a>) is a family of fast secure
--   cryptographic hash functions designed by Niels Ferguson, Stefan Lucks,
--   Bruce Schneier, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon
--   Callas and Jesse Walker.
--   
--   This package uses bindings to the optimized C implementation of Skein.
--   We provide a high-level interface (see module <a>Crypto.Skein</a>) to
--   some of the Skein use cases. We also provide a low-level interface
--   (see module <a>Crypto.Skein.Internal</a>) should you need to use Skein
--   in a different way.
--   
--   Currently we have support for Skein as cryptographic hash function as
--   Skein as a message authentication code (Skein-MAC). For examples of
--   how to use this package, see <a>Crypto.Skein</a> module documentation.
--   
--   This package includes Skein v1.3. Versions of this package before
--   1.0.0 implemented Skein v1.1.
@package skein
@version 1.0.9.4


-- | Basic wrappers around the C library. You shouldn't need to use these
--   functions. Instead, use the high-level <a>Crypto.Skein</a> module.
module Crypto.Skein.Internal
sKEIN_SUCCESS :: CInt
sKEIN_FAIL :: CInt
sKEIN_BAD_HASHLEN :: CInt

-- | Throws exception if the function does not return successfully.
check :: IO CInt -> IO ()
newtype Skein256Ctx
S256Ctx :: ByteString -> Skein256Ctx
[unS256Ctx] :: Skein256Ctx -> ByteString
skein256Init :: Ptr Skein256Ctx -> CSize -> IO CInt
skein256Update :: Ptr Skein256Ctx -> Ptr Word8 -> CSize -> IO CInt
skein256Final :: Ptr Skein256Ctx -> Ptr Word8 -> IO CInt
skein256InitExt :: Ptr Skein256Ctx -> CSize -> Word64 -> Ptr Word8 -> CSize -> IO CInt
skein256FinalPad :: Ptr Skein256Ctx -> Ptr Word8 -> IO CInt
skein256Output :: Ptr Skein256Ctx -> Ptr Word8 -> IO CInt
newtype Skein512Ctx
S512Ctx :: ByteString -> Skein512Ctx
[unS512Ctx] :: Skein512Ctx -> ByteString
skein512Init :: Ptr Skein512Ctx -> CSize -> IO CInt
skein512Update :: Ptr Skein512Ctx -> Ptr Word8 -> CSize -> IO CInt
skein512Final :: Ptr Skein512Ctx -> Ptr Word8 -> IO CInt
skein512InitExt :: Ptr Skein512Ctx -> CSize -> Word64 -> Ptr Word8 -> CSize -> IO CInt
skein512FinalPad :: Ptr Skein512Ctx -> Ptr Word8 -> IO CInt
skein512Output :: Ptr Skein512Ctx -> Ptr Word8 -> IO CInt
newtype Skein1024Ctx
S1024Ctx :: ByteString -> Skein1024Ctx
[unS1024Ctx] :: Skein1024Ctx -> ByteString
skein1024Init :: Ptr Skein1024Ctx -> CSize -> IO CInt
skein1024Update :: Ptr Skein1024Ctx -> Ptr Word8 -> CSize -> IO CInt
skein1024Final :: Ptr Skein1024Ctx -> Ptr Word8 -> IO CInt
skein1024InitExt :: Ptr Skein1024Ctx -> CSize -> Word64 -> Ptr Word8 -> CSize -> IO CInt
skein1024FinalPad :: Ptr Skein1024Ctx -> Ptr Word8 -> IO CInt
skein1024Output :: Ptr Skein1024Ctx -> Ptr Word8 -> IO CInt

-- | Pass to <tt>InitExt</tt> to get sequential processing.
sKEIN_SEQUENTIAL :: Word64
instance Foreign.Storable.Storable Crypto.Skein.Internal.Skein256Ctx
instance Foreign.Storable.Storable Crypto.Skein.Internal.Skein512Ctx
instance Foreign.Storable.Storable Crypto.Skein.Internal.Skein1024Ctx


-- | High-level interface for the Skein family of hash functions.
module Crypto.Skein

-- | Skein-512-512 hash. You probably want to use <a>encode</a> to obtain a
--   512-bit (64-byte) <a>ByteString</a>. It's the main Skein hash
--   function. May be used as a drop-in replacement for SHA-512 as well.
data Skein_512_512

-- | Context of the Skein-512-512 hash function.
data Skein_512_512_Ctx

-- | Skein-1024-1024 hash. You probably want to use <a>encode</a> to obtain
--   a 1024-bit (128-byte) <a>ByteString</a>. This is the
--   ultra-conservative variant. Even if some future attack managed to
--   break Skein-512, it's quite likely that Skein-1024 would remain
--   secure.
data Skein_1024_1024

-- | Context of the Skein-1024-1024 hash function.
data Skein_1024_1024_Ctx

-- | Skein-256-256 hash. You probably want to use <a>encode</a> to obtain a
--   256-bit (32-byte) <a>ByteString</a>. Usually it's better to use
--   <a>Skein_512_256</a> (256 bits of output) or <a>Skein_512_512</a> (512
--   bits of output).
data Skein_256_256

-- | Context of the Skein-256-256 hash function.
data Skein_256_256_Ctx

-- | Secret key used to calculate the Skein-MAC.
--   
--   The <a>Key</a> may have any length. However, it's recommended to have
--   at least the same number of bits of the state size. For example, when
--   using <a>skeinMAC</a> with <a>Skein_512_256</a>, it is recommended to
--   have a key with at least 64 bytes (512 bits), which is the state size
--   of <a>Skein_512_256</a> (the first of the two numbers).
type Key = ByteString

-- | Calculate the Skein-MAC of a lazy <a>ByteString</a> given a
--   <a>Key</a>. You probably also want to apply <a>encode</a> to get a
--   <a>ByteString</a> out of the <tt>digest</tt>.
--   
--   This function may be partially applied for increased performance.
--   Using a partially applied <tt>skeinMAC</tt> is as fast as using Skein
--   as a cryptographic hash function. So, instead of
--   
--   <pre>
--   let mac1 = skeinMAC key message1
--       mac2 = skeinMAC key message2
--       mac3 = skeinMAC key message3
--       ...
--   </pre>
--   
--   write the following code:
--   
--   <pre>
--   let calcMAC = skeinMAC key
--       mac1 = calcMAC message1
--       mac2 = calcMAC message2
--       mac3 = calcMAC message3
--       ...
--   </pre>
--   
--   This way the key will be processed only once (with
--   <a>skeinMACCtx</a>).
skeinMAC :: (SkeinMAC skeinCtx, Hash skeinCtx digest) => Key -> ByteString -> digest

-- | Same as <a>skeinMAC</a>, however using a strict <a>ByteString</a>.
--   Should be faster for small <a>ByteString</a><tt>s</tt>.
skeinMAC' :: (SkeinMAC skeinCtx, Hash skeinCtx digest) => Key -> ByteString -> digest

-- | Class of Skein contexts that may be used for Skein-MAC (all of them).
--   Included here mostly for documentation purposes, since adding new
--   instances is not safe (functions using <a>SkeinMAC</a> unsurprisingly
--   assume that they are using Skein).
class SkeinMAC skeinCtx

-- | Construct a context <tt>skeinCtx</tt> given a <a>Key</a>. This context
--   may be used with the usual <a>Hash</a> interface to obtain a message
--   authentication code (MAC).
--   
--   For a simpler interface, see <a>skeinMAC</a> and <a>skeinMAC'</a>.
skeinMACCtx :: SkeinMAC skeinCtx => Key -> skeinCtx

-- | Skein-256-128 hash. You probably want to use <a>encode</a> to obtain a
--   128-bit (16-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for MD5.
data Skein_256_128

-- | Context of the Skein-256-128 hash function.
data Skein_256_128_Ctx

-- | Skein-256-160 hash. You probably want to use <a>encode</a> to obtain a
--   160-bit (20-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-1.
data Skein_256_160

-- | Context of the Skein-256-160 hash function.
data Skein_256_160_Ctx

-- | Skein-256-224 hash. You probably want to use <a>encode</a> to obtain a
--   224-bit (28-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-224.
data Skein_256_224

-- | Context of the Skein-256-224 hash function.
data Skein_256_224_Ctx

-- | Skein-512-128 hash. You probably want to use <a>encode</a> to obtain a
--   128-bit (16-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for MD5.
data Skein_512_128

-- | Context of the Skein-512-128 hash function.
data Skein_512_128_Ctx

-- | Skein-512-160 hash. You probably want to use <a>encode</a> to obtain a
--   160-bit (20-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-1.
data Skein_512_160

-- | Context of the Skein-512-160 hash function.
data Skein_512_160_Ctx

-- | Skein-512-224 hash. You probably want to use <a>encode</a> to obtain a
--   224-bit (28-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-224.
data Skein_512_224

-- | Context of the Skein-512-224 hash function.
data Skein_512_224_Ctx

-- | Skein-512-256 hash. You probably want to use <a>encode</a> to obtain a
--   256-bit (32-byte) <a>ByteString</a>.
data Skein_512_256

-- | Context of the Skein-512-256 hash function.
data Skein_512_256_Ctx

-- | Skein-512-384 hash. You probably want to use <a>encode</a> to obtain a
--   384-bit (48-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-384.
data Skein_512_384

-- | Context of the Skein-512-384 hash function.
data Skein_512_384_Ctx

-- | Skein-1024-384 hash. You probably want to use <a>encode</a> to obtain
--   a 384-bit (48-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-384.
data Skein_1024_384

-- | Context of the Skein-1024-384 hash function.
data Skein_1024_384_Ctx

-- | Skein-1024-512 hash. You probably want to use <a>encode</a> to obtain
--   a 512-bit (64-byte) <a>ByteString</a>. May be used as a drop-in
--   replacement for SHA-512.
data Skein_1024_512

-- | Context of the Skein-1024-512 hash function.
data Skein_1024_512_Ctx
instance GHC.Classes.Ord Crypto.Skein.Skein_1024_1024
instance GHC.Classes.Eq Crypto.Skein.Skein_1024_1024
instance GHC.Classes.Ord Crypto.Skein.Skein_1024_512
instance GHC.Classes.Eq Crypto.Skein.Skein_1024_512
instance GHC.Classes.Ord Crypto.Skein.Skein_1024_384
instance GHC.Classes.Eq Crypto.Skein.Skein_1024_384
instance GHC.Classes.Ord Crypto.Skein.Skein_512_512
instance GHC.Classes.Eq Crypto.Skein.Skein_512_512
instance GHC.Classes.Ord Crypto.Skein.Skein_512_384
instance GHC.Classes.Eq Crypto.Skein.Skein_512_384
instance GHC.Classes.Ord Crypto.Skein.Skein_512_256
instance GHC.Classes.Eq Crypto.Skein.Skein_512_256
instance GHC.Classes.Ord Crypto.Skein.Skein_512_224
instance GHC.Classes.Eq Crypto.Skein.Skein_512_224
instance GHC.Classes.Ord Crypto.Skein.Skein_512_160
instance GHC.Classes.Eq Crypto.Skein.Skein_512_160
instance GHC.Classes.Ord Crypto.Skein.Skein_512_128
instance GHC.Classes.Eq Crypto.Skein.Skein_512_128
instance GHC.Classes.Ord Crypto.Skein.Skein_256_256
instance GHC.Classes.Eq Crypto.Skein.Skein_256_256
instance GHC.Classes.Ord Crypto.Skein.Skein_256_224
instance GHC.Classes.Eq Crypto.Skein.Skein_256_224
instance GHC.Classes.Ord Crypto.Skein.Skein_256_160
instance GHC.Classes.Eq Crypto.Skein.Skein_256_160
instance GHC.Classes.Ord Crypto.Skein.Skein_256_128
instance GHC.Classes.Eq Crypto.Skein.Skein_256_128
instance Data.Serialize.Serialize Crypto.Skein.Skein_256_128
instance Crypto.Classes.Hash Crypto.Skein.Skein_256_128_Ctx Crypto.Skein.Skein_256_128
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_256_128_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_256_160
instance Crypto.Classes.Hash Crypto.Skein.Skein_256_160_Ctx Crypto.Skein.Skein_256_160
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_256_160_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_256_224
instance Crypto.Classes.Hash Crypto.Skein.Skein_256_224_Ctx Crypto.Skein.Skein_256_224
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_256_224_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_256_256
instance Crypto.Classes.Hash Crypto.Skein.Skein_256_256_Ctx Crypto.Skein.Skein_256_256
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_256_256_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_128
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_128_Ctx Crypto.Skein.Skein_512_128
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_128_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_160
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_160_Ctx Crypto.Skein.Skein_512_160
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_160_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_224
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_224_Ctx Crypto.Skein.Skein_512_224
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_224_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_256
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_256_Ctx Crypto.Skein.Skein_512_256
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_256_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_384
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_384_Ctx Crypto.Skein.Skein_512_384
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_384_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_512_512
instance Crypto.Classes.Hash Crypto.Skein.Skein_512_512_Ctx Crypto.Skein.Skein_512_512
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_512_512_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_1024_384
instance Crypto.Classes.Hash Crypto.Skein.Skein_1024_384_Ctx Crypto.Skein.Skein_1024_384
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_1024_384_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_1024_512
instance Crypto.Classes.Hash Crypto.Skein.Skein_1024_512_Ctx Crypto.Skein.Skein_1024_512
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_1024_512_Ctx
instance Data.Serialize.Serialize Crypto.Skein.Skein_1024_1024
instance Crypto.Classes.Hash Crypto.Skein.Skein_1024_1024_Ctx Crypto.Skein.Skein_1024_1024
instance Crypto.Skein.SkeinMAC Crypto.Skein.Skein_1024_1024_Ctx
