module Botan.BlockCipher.SHALCAL
( SHALCAL2(..)
, SHALCAL2SecretKey(..)
, pattern SHALCAL2SecretKey
, getSHALCAL2SecretKey
, SHALCAL2Ciphertext(..)
, shalcal2Encrypt
, shalcal2Decrypt
, shalcal2EncryptLazy
, shalcal2DecryptLazy
) 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

-- SHALCAL2 type

data SHALCAL2

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

pattern SHALCAL2SecretKey :: ByteString -> SecretKey SHALCAL2
pattern $mSHALCAL2SecretKey :: forall {r}.
SecretKey SHALCAL2 -> (ByteString -> r) -> ((# #) -> r) -> r
$bSHALCAL2SecretKey :: ByteString -> SecretKey SHALCAL2
SHALCAL2SecretKey bytes = MkSHALCAL2SecretKey (MkGSecretKey bytes)

getSHALCAL2SecretKey :: SecretKey SHALCAL2 -> ByteString
getSHALCAL2SecretKey :: SecretKey SHALCAL2 -> ByteString
getSHALCAL2SecretKey (SHALCAL2SecretKey ByteString
bs) = ByteString
bs

type SHALCAL2SecretKey = SecretKey SHALCAL2

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

pattern SHALCAL2Ciphertext :: ByteString -> Ciphertext SHALCAL2
pattern $mSHALCAL2Ciphertext :: forall {r}.
Ciphertext SHALCAL2 -> (ByteString -> r) -> ((# #) -> r) -> r
$bSHALCAL2Ciphertext :: ByteString -> Ciphertext SHALCAL2
SHALCAL2Ciphertext bs = MkSHALCAL2Ciphertext (MkGCiphertext bs)

getSHALCAL2Ciphertext :: Ciphertext SHALCAL2 -> ByteString
getSHALCAL2Ciphertext :: Ciphertext SHALCAL2 -> ByteString
getSHALCAL2Ciphertext (SHALCAL2Ciphertext ByteString
bs) = ByteString
bs

type SHALCAL2Ciphertext = Ciphertext SHALCAL2

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

pattern SHALCAL2LazyCiphertext :: Lazy.ByteString -> LazyCiphertext SHALCAL2
pattern $mSHALCAL2LazyCiphertext :: forall {r}.
LazyCiphertext SHALCAL2 -> (ByteString -> r) -> ((# #) -> r) -> r
$bSHALCAL2LazyCiphertext :: ByteString -> LazyCiphertext SHALCAL2
SHALCAL2LazyCiphertext lbs = MkSHALCAL2LazyCiphertext (MkGLazyCiphertext lbs)

getSHALCAL2LazyCiphertext :: LazyCiphertext SHALCAL2 -> Lazy.ByteString
getSHALCAL2LazyCiphertext :: LazyCiphertext SHALCAL2 -> ByteString
getSHALCAL2LazyCiphertext (SHALCAL2LazyCiphertext ByteString
bs) = ByteString
bs

type SHALCAL2LazyCiphertext = LazyCiphertext SHALCAL2

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

instance (MonadRandomIO m )=> SecretKeyGen SHALCAL2 m where

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

instance HasCiphertext SHALCAL2 where

instance BlockCipher SHALCAL2 where

    blockCipherEncrypt :: SecretKey SHALCAL2 -> ByteString -> Maybe (Ciphertext SHALCAL2)
    blockCipherEncrypt :: SecretKey SHALCAL2 -> ByteString -> Maybe (Ciphertext SHALCAL2)
blockCipherEncrypt (SHALCAL2SecretKey ByteString
k) = (ByteString -> Ciphertext SHALCAL2)
-> Maybe ByteString -> Maybe (Ciphertext SHALCAL2)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext SHALCAL2
SHALCAL2Ciphertext (Maybe ByteString -> Maybe (Ciphertext SHALCAL2))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext SHALCAL2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.shalcal2 ByteString
k

    blockCipherDecrypt :: SecretKey SHALCAL2 -> Ciphertext SHALCAL2 -> Maybe ByteString
    blockCipherDecrypt :: SecretKey SHALCAL2 -> Ciphertext SHALCAL2 -> Maybe ByteString
blockCipherDecrypt (SHALCAL2SecretKey ByteString
k) (SHALCAL2Ciphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.shalcal2 ByteString
k ByteString
ct

instance HasLazyCiphertext SHALCAL2 where

instance IncrementalBlockCipher SHALCAL2 where

    blockCipherEncryptLazy :: SecretKey SHALCAL2 -> Lazy.ByteString -> Maybe (LazyCiphertext SHALCAL2)
    blockCipherEncryptLazy :: SecretKey SHALCAL2 -> ByteString -> Maybe (LazyCiphertext SHALCAL2)
blockCipherEncryptLazy (SHALCAL2SecretKey ByteString
k) = (ByteString -> LazyCiphertext SHALCAL2)
-> Maybe ByteString -> Maybe (LazyCiphertext SHALCAL2)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext SHALCAL2
SHALCAL2LazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext SHALCAL2))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext SHALCAL2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.shalcal2 ByteString
k

    blockCipherDecryptLazy :: SecretKey SHALCAL2 -> LazyCiphertext SHALCAL2 -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey SHALCAL2 -> LazyCiphertext SHALCAL2 -> Maybe ByteString
blockCipherDecryptLazy (SHALCAL2SecretKey ByteString
k) (SHALCAL2LazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.shalcal2 ByteString
k ByteString
ct

-- SHALCAL2 blockCipher

shalcal2Encrypt :: SecretKey SHALCAL2 -> ByteString -> Maybe SHALCAL2Ciphertext
shalcal2Encrypt :: SecretKey SHALCAL2 -> ByteString -> Maybe (Ciphertext SHALCAL2)
shalcal2Encrypt = SecretKey SHALCAL2 -> ByteString -> Maybe (Ciphertext SHALCAL2)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

shalcal2Decrypt :: SecretKey SHALCAL2 -> SHALCAL2Ciphertext -> Maybe ByteString
shalcal2Decrypt :: SecretKey SHALCAL2 -> Ciphertext SHALCAL2 -> Maybe ByteString
shalcal2Decrypt = SecretKey SHALCAL2 -> Ciphertext SHALCAL2 -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

shalcal2EncryptLazy :: SecretKey SHALCAL2 -> Lazy.ByteString -> Maybe SHALCAL2LazyCiphertext
shalcal2EncryptLazy :: SecretKey SHALCAL2 -> ByteString -> Maybe (LazyCiphertext SHALCAL2)
shalcal2EncryptLazy = SecretKey SHALCAL2 -> ByteString -> Maybe (LazyCiphertext SHALCAL2)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

shalcal2DecryptLazy :: SecretKey SHALCAL2 -> SHALCAL2LazyCiphertext -> Maybe Lazy.ByteString
shalcal2DecryptLazy :: SecretKey SHALCAL2 -> LazyCiphertext SHALCAL2 -> Maybe ByteString
shalcal2DecryptLazy = SecretKey SHALCAL2 -> LazyCiphertext SHALCAL2 -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy