    -- |
    -- Module      : Crypto.Cipher.Camellia
    -- License     : BSD-style
    -- Maintainer  : Vincent Hanquez <vincent@snarc.org>
    -- Stability   : experimental
    -- Portability : Good
    --
    -- Camellia support. only 128 bit variant available for now.

    module Crypto.Cipher.Camellia
        ( Camellia128
        ) where

    import Crypto.Cipher.Camellia.Primitive
    import Crypto.Cipher.Types
    import Data.Byteable

    -- | Camellia block cipher with 128 bit key
    newtype Camellia128 = Camellia128 Camellia

    instance Cipher Camellia128 where
        cipherName :: Camellia128 -> String
    cipherName    Camellia128
    _ = String
    "Camellia128"
        cipherKeySize :: Camellia128 -> KeySizeSpecifier
    cipherKeySize Camellia128
    _ = Int -> KeySizeSpecifier
    KeySizeFixed Int
    16
        cipherInit :: Key Camellia128 -> Camellia128
    cipherInit Key Camellia128
    k    = (String -> Camellia128)
    -> (Camellia -> Camellia128)
    -> Either String Camellia
    -> Camellia128
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either String -> Camellia128
    forall a. HasCallStack => String -> a
    error Camellia -> Camellia128
    Camellia128 (Either String Camellia -> Camellia128)
    -> Either String Camellia -> Camellia128
    forall a b. (a -> b) -> a -> b
    $ ByteString -> Either String Camellia
    initCamellia (ByteString -> Either String Camellia)
    -> ByteString -> Either String Camellia
    forall a b. (a -> b) -> a -> b
    $ Key Camellia128 -> ByteString
    forall a. Byteable a => a -> ByteString
    toBytes Key Camellia128
    k

    instance BlockCipher Camellia128 where
        blockSize :: Camellia128 -> Int
    blockSize Camellia128
    _ = Int
    16
        ecbEncrypt :: Camellia128 -> ByteString -> ByteString
    ecbEncrypt (Camellia128 Camellia
    key) = Camellia -> ByteString -> ByteString
    encrypt Camellia
    key
        ecbDecrypt :: Camellia128 -> ByteString -> ByteString
    ecbDecrypt (Camellia128 Camellia
    key) = Camellia -> ByteString -> ByteString
    decrypt Camellia
    key