module Botan.BlockCipher.Twofish
( Twofish(..)
, TwofishSecretKey(..)
, pattern TwofishSecretKey
, getTwofishSecretKey
, TwofishCiphertext(..)
, twofishEncrypt
, twofishDecrypt
, twofishEncryptLazy
, twofishDecryptLazy
) 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

-- Twofish type

data Twofish

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

pattern TwofishSecretKey :: ByteString -> SecretKey Twofish
pattern $mTwofishSecretKey :: forall {r}.
SecretKey Twofish -> (ByteString -> r) -> ((# #) -> r) -> r
$bTwofishSecretKey :: ByteString -> SecretKey Twofish
TwofishSecretKey bytes = MkTwofishSecretKey (MkGSecretKey bytes)

getTwofishSecretKey :: SecretKey Twofish -> ByteString
getTwofishSecretKey :: SecretKey Twofish -> ByteString
getTwofishSecretKey (TwofishSecretKey ByteString
bs) = ByteString
bs

type TwofishSecretKey = SecretKey Twofish

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

pattern TwofishCiphertext :: ByteString -> Ciphertext Twofish
pattern $mTwofishCiphertext :: forall {r}.
Ciphertext Twofish -> (ByteString -> r) -> ((# #) -> r) -> r
$bTwofishCiphertext :: ByteString -> Ciphertext Twofish
TwofishCiphertext bs = MkTwofishCiphertext (MkGCiphertext bs)

getTwofishCiphertext :: Ciphertext Twofish -> ByteString
getTwofishCiphertext :: Ciphertext Twofish -> ByteString
getTwofishCiphertext (TwofishCiphertext ByteString
bs) = ByteString
bs

type TwofishCiphertext = Ciphertext Twofish

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

pattern TwofishLazyCiphertext :: Lazy.ByteString -> LazyCiphertext Twofish
pattern $mTwofishLazyCiphertext :: forall {r}.
LazyCiphertext Twofish -> (ByteString -> r) -> ((# #) -> r) -> r
$bTwofishLazyCiphertext :: ByteString -> LazyCiphertext Twofish
TwofishLazyCiphertext lbs = MkTwofishLazyCiphertext (MkGLazyCiphertext lbs)

getTwofishLazyCiphertext :: LazyCiphertext Twofish -> Lazy.ByteString
getTwofishLazyCiphertext :: LazyCiphertext Twofish -> ByteString
getTwofishLazyCiphertext (TwofishLazyCiphertext ByteString
bs) = ByteString
bs

type TwofishLazyCiphertext = LazyCiphertext Twofish

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

instance (MonadRandomIO m )=> SecretKeyGen Twofish m where

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

instance HasCiphertext Twofish where

instance BlockCipher Twofish where

    blockCipherEncrypt :: SecretKey Twofish -> ByteString -> Maybe (Ciphertext Twofish)
    blockCipherEncrypt :: SecretKey Twofish -> ByteString -> Maybe (Ciphertext Twofish)
blockCipherEncrypt (TwofishSecretKey ByteString
k) = (ByteString -> Ciphertext Twofish)
-> Maybe ByteString -> Maybe (Ciphertext Twofish)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext Twofish
TwofishCiphertext (Maybe ByteString -> Maybe (Ciphertext Twofish))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext Twofish)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.twofish ByteString
k

    blockCipherDecrypt :: SecretKey Twofish -> Ciphertext Twofish -> Maybe ByteString
    blockCipherDecrypt :: SecretKey Twofish -> Ciphertext Twofish -> Maybe ByteString
blockCipherDecrypt (TwofishSecretKey ByteString
k) (TwofishCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.twofish ByteString
k ByteString
ct

instance HasLazyCiphertext Twofish where

instance IncrementalBlockCipher Twofish where

    blockCipherEncryptLazy :: SecretKey Twofish -> Lazy.ByteString -> Maybe (LazyCiphertext Twofish)
    blockCipherEncryptLazy :: SecretKey Twofish -> ByteString -> Maybe (LazyCiphertext Twofish)
blockCipherEncryptLazy (TwofishSecretKey ByteString
k) = (ByteString -> LazyCiphertext Twofish)
-> Maybe ByteString -> Maybe (LazyCiphertext Twofish)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext Twofish
TwofishLazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext Twofish))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext Twofish)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.twofish ByteString
k

    blockCipherDecryptLazy :: SecretKey Twofish -> LazyCiphertext Twofish -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey Twofish -> LazyCiphertext Twofish -> Maybe ByteString
blockCipherDecryptLazy (TwofishSecretKey ByteString
k) (TwofishLazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.twofish ByteString
k ByteString
ct

-- Twofish blockCipher

twofishEncrypt :: SecretKey Twofish -> ByteString -> Maybe TwofishCiphertext
twofishEncrypt :: SecretKey Twofish -> ByteString -> Maybe (Ciphertext Twofish)
twofishEncrypt = SecretKey Twofish -> ByteString -> Maybe (Ciphertext Twofish)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

twofishDecrypt :: SecretKey Twofish -> TwofishCiphertext -> Maybe ByteString
twofishDecrypt :: SecretKey Twofish -> Ciphertext Twofish -> Maybe ByteString
twofishDecrypt = SecretKey Twofish -> Ciphertext Twofish -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

twofishEncryptLazy :: SecretKey Twofish -> Lazy.ByteString -> Maybe TwofishLazyCiphertext
twofishEncryptLazy :: SecretKey Twofish -> ByteString -> Maybe (LazyCiphertext Twofish)
twofishEncryptLazy = SecretKey Twofish -> ByteString -> Maybe (LazyCiphertext Twofish)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

twofishDecryptLazy :: SecretKey Twofish -> TwofishLazyCiphertext -> Maybe Lazy.ByteString
twofishDecryptLazy :: SecretKey Twofish -> LazyCiphertext Twofish -> Maybe ByteString
twofishDecryptLazy = SecretKey Twofish -> LazyCiphertext Twofish -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy

-- Temporary BlockCipher128 conformance

instance BlockCipher128 Twofish where
instance IncrementalBlockCipher128 Twofish where