module Botan.BlockCipher.CAST
( CAST128(..)
, CAST128SecretKey(..)
, pattern CAST128SecretKey
, getCAST128SecretKey
, CAST128Ciphertext(..)
, cast128Encrypt
, cast128Decrypt
, cast128EncryptLazy
, cast128DecryptLazy
) where

import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.Text as Text

import qualified Botan.BlockCipher as Botan
import qualified Botan.Utility as Botan

import Botan.Prelude hiding (Ciphertext, LazyCiphertext)

import Botan.BlockCipher.Class
import Botan.Types.Class
import Botan.RNG

-- CAST128 type

data CAST128

newtype instance SecretKey CAST128 = MkCAST128SecretKey GSecretKey
    deriving newtype (SecretKey CAST128 -> SecretKey CAST128 -> Bool
(SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> (SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> Eq (SecretKey CAST128)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
== :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
$c/= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
/= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
Eq, Eq (SecretKey CAST128)
Eq (SecretKey CAST128) =>
(SecretKey CAST128 -> SecretKey CAST128 -> Ordering)
-> (SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> (SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> (SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> (SecretKey CAST128 -> SecretKey CAST128 -> Bool)
-> (SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128)
-> (SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128)
-> Ord (SecretKey CAST128)
SecretKey CAST128 -> SecretKey CAST128 -> Bool
SecretKey CAST128 -> SecretKey CAST128 -> Ordering
SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SecretKey CAST128 -> SecretKey CAST128 -> Ordering
compare :: SecretKey CAST128 -> SecretKey CAST128 -> Ordering
$c< :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
< :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
$c<= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
<= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
$c> :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
> :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
$c>= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
>= :: SecretKey CAST128 -> SecretKey CAST128 -> Bool
$cmax :: SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128
max :: SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128
$cmin :: SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128
min :: SecretKey CAST128 -> SecretKey CAST128 -> SecretKey CAST128
Ord, Int -> SecretKey CAST128 -> ShowS
[SecretKey CAST128] -> ShowS
SecretKey CAST128 -> String
(Int -> SecretKey CAST128 -> ShowS)
-> (SecretKey CAST128 -> String)
-> ([SecretKey CAST128] -> ShowS)
-> Show (SecretKey CAST128)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SecretKey CAST128 -> ShowS
showsPrec :: Int -> SecretKey CAST128 -> ShowS
$cshow :: SecretKey CAST128 -> String
show :: SecretKey CAST128 -> String
$cshowList :: [SecretKey CAST128] -> ShowS
showList :: [SecretKey CAST128] -> ShowS
Show, ByteString -> Maybe (SecretKey CAST128)
SecretKey CAST128 -> ByteString
(SecretKey CAST128 -> ByteString)
-> (ByteString -> Maybe (SecretKey CAST128))
-> Encodable (SecretKey CAST128)
forall a.
(a -> ByteString) -> (ByteString -> Maybe a) -> Encodable a
$cencode :: SecretKey CAST128 -> ByteString
encode :: SecretKey CAST128 -> ByteString
$cdecode :: ByteString -> Maybe (SecretKey CAST128)
decode :: ByteString -> Maybe (SecretKey CAST128)
Encodable)

pattern CAST128SecretKey :: ByteString -> SecretKey CAST128
pattern $mCAST128SecretKey :: forall {r}.
SecretKey CAST128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bCAST128SecretKey :: ByteString -> SecretKey CAST128
CAST128SecretKey bytes = MkCAST128SecretKey (MkGSecretKey bytes)

getCAST128SecretKey :: SecretKey CAST128 -> ByteString
getCAST128SecretKey :: SecretKey CAST128 -> ByteString
getCAST128SecretKey (CAST128SecretKey ByteString
bs) = ByteString
bs

type CAST128SecretKey = SecretKey CAST128

newtype instance Ciphertext CAST128 = MkCAST128Ciphertext GCiphertext
    deriving newtype (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
(Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> Eq (Ciphertext CAST128)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
== :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
$c/= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
/= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
Eq, Eq (Ciphertext CAST128)
Eq (Ciphertext CAST128) =>
(Ciphertext CAST128 -> Ciphertext CAST128 -> Ordering)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Bool)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128)
-> (Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128)
-> Ord (Ciphertext CAST128)
Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
Ciphertext CAST128 -> Ciphertext CAST128 -> Ordering
Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ordering
compare :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ordering
$c< :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
< :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
$c<= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
<= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
$c> :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
> :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
$c>= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
>= :: Ciphertext CAST128 -> Ciphertext CAST128 -> Bool
$cmax :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128
max :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128
$cmin :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128
min :: Ciphertext CAST128 -> Ciphertext CAST128 -> Ciphertext CAST128
Ord, Int -> Ciphertext CAST128 -> ShowS
[Ciphertext CAST128] -> ShowS
Ciphertext CAST128 -> String
(Int -> Ciphertext CAST128 -> ShowS)
-> (Ciphertext CAST128 -> String)
-> ([Ciphertext CAST128] -> ShowS)
-> Show (Ciphertext CAST128)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Ciphertext CAST128 -> ShowS
showsPrec :: Int -> Ciphertext CAST128 -> ShowS
$cshow :: Ciphertext CAST128 -> String
show :: Ciphertext CAST128 -> String
$cshowList :: [Ciphertext CAST128] -> ShowS
showList :: [Ciphertext CAST128] -> ShowS
Show, ByteString -> Maybe (Ciphertext CAST128)
Ciphertext CAST128 -> ByteString
(Ciphertext CAST128 -> ByteString)
-> (ByteString -> Maybe (Ciphertext CAST128))
-> Encodable (Ciphertext CAST128)
forall a.
(a -> ByteString) -> (ByteString -> Maybe a) -> Encodable a
$cencode :: Ciphertext CAST128 -> ByteString
encode :: Ciphertext CAST128 -> ByteString
$cdecode :: ByteString -> Maybe (Ciphertext CAST128)
decode :: ByteString -> Maybe (Ciphertext CAST128)
Encodable)

pattern CAST128Ciphertext :: ByteString -> Ciphertext CAST128
pattern $mCAST128Ciphertext :: forall {r}.
Ciphertext CAST128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bCAST128Ciphertext :: ByteString -> Ciphertext CAST128
CAST128Ciphertext bs = MkCAST128Ciphertext (MkGCiphertext bs)

getCAST128Ciphertext :: Ciphertext CAST128 -> ByteString
getCAST128Ciphertext :: Ciphertext CAST128 -> ByteString
getCAST128Ciphertext (CAST128Ciphertext ByteString
bs) = ByteString
bs

type CAST128Ciphertext = Ciphertext CAST128

newtype instance LazyCiphertext CAST128 = MkCAST128LazyCiphertext GLazyCiphertext
    deriving newtype (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
(LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> Eq (LazyCiphertext CAST128)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
== :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
$c/= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
/= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
Eq, Eq (LazyCiphertext CAST128)
Eq (LazyCiphertext CAST128) =>
(LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Ordering)
-> (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> (LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool)
-> (LazyCiphertext CAST128
    -> LazyCiphertext CAST128 -> LazyCiphertext CAST128)
-> (LazyCiphertext CAST128
    -> LazyCiphertext CAST128 -> LazyCiphertext CAST128)
-> Ord (LazyCiphertext CAST128)
LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Ordering
LazyCiphertext CAST128
-> LazyCiphertext CAST128 -> LazyCiphertext CAST128
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Ordering
compare :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Ordering
$c< :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
< :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
$c<= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
<= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
$c> :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
> :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
$c>= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
>= :: LazyCiphertext CAST128 -> LazyCiphertext CAST128 -> Bool
$cmax :: LazyCiphertext CAST128
-> LazyCiphertext CAST128 -> LazyCiphertext CAST128
max :: LazyCiphertext CAST128
-> LazyCiphertext CAST128 -> LazyCiphertext CAST128
$cmin :: LazyCiphertext CAST128
-> LazyCiphertext CAST128 -> LazyCiphertext CAST128
min :: LazyCiphertext CAST128
-> LazyCiphertext CAST128 -> LazyCiphertext CAST128
Ord, Int -> LazyCiphertext CAST128 -> ShowS
[LazyCiphertext CAST128] -> ShowS
LazyCiphertext CAST128 -> String
(Int -> LazyCiphertext CAST128 -> ShowS)
-> (LazyCiphertext CAST128 -> String)
-> ([LazyCiphertext CAST128] -> ShowS)
-> Show (LazyCiphertext CAST128)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LazyCiphertext CAST128 -> ShowS
showsPrec :: Int -> LazyCiphertext CAST128 -> ShowS
$cshow :: LazyCiphertext CAST128 -> String
show :: LazyCiphertext CAST128 -> String
$cshowList :: [LazyCiphertext CAST128] -> ShowS
showList :: [LazyCiphertext CAST128] -> ShowS
Show, ByteString -> Maybe (LazyCiphertext CAST128)
LazyCiphertext CAST128 -> ByteString
(LazyCiphertext CAST128 -> ByteString)
-> (ByteString -> Maybe (LazyCiphertext CAST128))
-> Encodable (LazyCiphertext CAST128)
forall a.
(a -> ByteString) -> (ByteString -> Maybe a) -> Encodable a
$cencode :: LazyCiphertext CAST128 -> ByteString
encode :: LazyCiphertext CAST128 -> ByteString
$cdecode :: ByteString -> Maybe (LazyCiphertext CAST128)
decode :: ByteString -> Maybe (LazyCiphertext CAST128)
Encodable, Encodable (LazyCiphertext CAST128)
ByteString -> Maybe (LazyCiphertext CAST128)
LazyCiphertext CAST128 -> ByteString
Encodable (LazyCiphertext CAST128) =>
(LazyCiphertext CAST128 -> ByteString)
-> (ByteString -> Maybe (LazyCiphertext CAST128))
-> LazyEncodable (LazyCiphertext CAST128)
forall a.
Encodable a =>
(a -> ByteString) -> (ByteString -> Maybe a) -> LazyEncodable a
$cencodeLazy :: LazyCiphertext CAST128 -> ByteString
encodeLazy :: LazyCiphertext CAST128 -> ByteString
$cdecodeLazy :: ByteString -> Maybe (LazyCiphertext CAST128)
decodeLazy :: ByteString -> Maybe (LazyCiphertext CAST128)
LazyEncodable)

pattern CAST128LazyCiphertext :: Lazy.ByteString -> LazyCiphertext CAST128
pattern $mCAST128LazyCiphertext :: forall {r}.
LazyCiphertext CAST128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bCAST128LazyCiphertext :: ByteString -> LazyCiphertext CAST128
CAST128LazyCiphertext lbs = MkCAST128LazyCiphertext (MkGLazyCiphertext lbs)

getCAST128LazyCiphertext :: LazyCiphertext CAST128 -> Lazy.ByteString
getCAST128LazyCiphertext :: LazyCiphertext CAST128 -> ByteString
getCAST128LazyCiphertext (CAST128LazyCiphertext ByteString
bs) = ByteString
bs

type CAST128LazyCiphertext = LazyCiphertext CAST128

instance HasSecretKey CAST128 where
    
    secretKeySpec :: SizeSpecifier (SecretKey CAST128)
    secretKeySpec :: SizeSpecifier (SecretKey CAST128)
secretKeySpec = SizeSpecifier () -> SizeSpecifier (SecretKey CAST128)
forall a b. SizeSpecifier a -> SizeSpecifier b
coerceSizeSpec (SizeSpecifier () -> SizeSpecifier (SecretKey CAST128))
-> SizeSpecifier () -> SizeSpecifier (SecretKey CAST128)
forall a b. (a -> b) -> a -> b
$ BlockCipher -> SizeSpecifier ()
Botan.blockCipherKeySpec BlockCipher
Botan.cast128

instance (MonadRandomIO m )=> SecretKeyGen CAST128 m where

    newSecretKey :: MonadRandomIO m => m (SecretKey CAST128)
    newSecretKey :: MonadRandomIO m => m (SecretKey CAST128)
newSecretKey = ByteString -> SecretKey CAST128
CAST128SecretKey (ByteString -> SecretKey CAST128)
-> m ByteString -> m (SecretKey CAST128)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SizeSpecifier (SecretKey CAST128) -> m ByteString
forall (m :: * -> *) a.
MonadRandomIO m =>
SizeSpecifier a -> m ByteString
newSized (forall alg. HasSecretKey alg => SizeSpecifier (SecretKey alg)
secretKeySpec @CAST128)
    
    newSecretKeyMaybe :: MonadRandomIO m => Int -> m (Maybe (SecretKey CAST128))
    newSecretKeyMaybe :: MonadRandomIO m => Int -> m (Maybe (SecretKey CAST128))
newSecretKeyMaybe Int
i = (ByteString -> SecretKey CAST128)
-> Maybe ByteString -> Maybe (SecretKey CAST128)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> SecretKey CAST128
CAST128SecretKey (Maybe ByteString -> Maybe (SecretKey CAST128))
-> m (Maybe ByteString) -> m (Maybe (SecretKey CAST128))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SizeSpecifier (SecretKey CAST128) -> Int -> m (Maybe ByteString)
forall (m :: * -> *) a.
MonadRandomIO m =>
SizeSpecifier a -> Int -> m (Maybe ByteString)
newSizedMaybe (forall alg. HasSecretKey alg => SizeSpecifier (SecretKey alg)
secretKeySpec @CAST128) Int
i

instance HasCiphertext CAST128 where

instance BlockCipher CAST128 where

    blockCipherEncrypt :: SecretKey CAST128 -> ByteString -> Maybe (Ciphertext CAST128)
    blockCipherEncrypt :: SecretKey CAST128 -> ByteString -> Maybe (Ciphertext CAST128)
blockCipherEncrypt (CAST128SecretKey ByteString
k) = (ByteString -> Ciphertext CAST128)
-> Maybe ByteString -> Maybe (Ciphertext CAST128)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext CAST128
CAST128Ciphertext (Maybe ByteString -> Maybe (Ciphertext CAST128))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext CAST128)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.cast128 ByteString
k

    blockCipherDecrypt :: SecretKey CAST128 -> Ciphertext CAST128 -> Maybe ByteString
    blockCipherDecrypt :: SecretKey CAST128 -> Ciphertext CAST128 -> Maybe ByteString
blockCipherDecrypt (CAST128SecretKey ByteString
k) (CAST128Ciphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.cast128 ByteString
k ByteString
ct

instance HasLazyCiphertext CAST128 where

instance IncrementalBlockCipher CAST128 where

    blockCipherEncryptLazy :: SecretKey CAST128 -> Lazy.ByteString -> Maybe (LazyCiphertext CAST128)
    blockCipherEncryptLazy :: SecretKey CAST128 -> ByteString -> Maybe (LazyCiphertext CAST128)
blockCipherEncryptLazy (CAST128SecretKey ByteString
k) = (ByteString -> LazyCiphertext CAST128)
-> Maybe ByteString -> Maybe (LazyCiphertext CAST128)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext CAST128
CAST128LazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext CAST128))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext CAST128)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.cast128 ByteString
k

    blockCipherDecryptLazy :: SecretKey CAST128 -> LazyCiphertext CAST128 -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey CAST128 -> LazyCiphertext CAST128 -> Maybe ByteString
blockCipherDecryptLazy (CAST128SecretKey ByteString
k) (CAST128LazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.cast128 ByteString
k ByteString
ct

-- CAST128 blockCipher

cast128Encrypt :: SecretKey CAST128 -> ByteString -> Maybe CAST128Ciphertext
cast128Encrypt :: SecretKey CAST128 -> ByteString -> Maybe (Ciphertext CAST128)
cast128Encrypt = SecretKey CAST128 -> ByteString -> Maybe (Ciphertext CAST128)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

cast128Decrypt :: SecretKey CAST128 -> CAST128Ciphertext -> Maybe ByteString
cast128Decrypt :: SecretKey CAST128 -> Ciphertext CAST128 -> Maybe ByteString
cast128Decrypt = SecretKey CAST128 -> Ciphertext CAST128 -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

cast128EncryptLazy :: SecretKey CAST128 -> Lazy.ByteString -> Maybe CAST128LazyCiphertext
cast128EncryptLazy :: SecretKey CAST128 -> ByteString -> Maybe (LazyCiphertext CAST128)
cast128EncryptLazy = SecretKey CAST128 -> ByteString -> Maybe (LazyCiphertext CAST128)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

cast128DecryptLazy :: SecretKey CAST128 -> CAST128LazyCiphertext -> Maybe Lazy.ByteString
cast128DecryptLazy :: SecretKey CAST128 -> LazyCiphertext CAST128 -> Maybe ByteString
cast128DecryptLazy = SecretKey CAST128 -> LazyCiphertext CAST128 -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy