module Botan.BlockCipher.ARIA
( ARIA128(..)
, ARIA128SecretKey(..)
, pattern ARIA128SecretKey
, getARIA128SecretKey
, ARIA128Ciphertext(..)
, aria128Encrypt
, aria128Decrypt
, aria128EncryptLazy
, aria128DecryptLazy
, ARIA192(..)
, ARIA192SecretKey(..)
, pattern ARIA192SecretKey
, getARIA192SecretKey
, ARIA192Ciphertext(..)
, aria192Encrypt
, aria192Decrypt
, aria192EncryptLazy
, aria192DecryptLazy
, ARIA256(..)
, ARIA256SecretKey(..)
, pattern ARIA256SecretKey
, getARIA256SecretKey
, ARIA256Ciphertext(..)
, aria256Encrypt
, aria256Decrypt
, aria256EncryptLazy
, aria256DecryptLazy
) 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

-- ARIA128 type

data ARIA128

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

pattern ARIA128SecretKey :: ByteString -> SecretKey ARIA128
pattern $mARIA128SecretKey :: forall {r}.
SecretKey ARIA128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA128SecretKey :: ByteString -> SecretKey ARIA128
ARIA128SecretKey bytes = MkARIA128SecretKey (MkGSecretKey bytes)

getARIA128SecretKey :: SecretKey ARIA128 -> ByteString
getARIA128SecretKey :: SecretKey ARIA128 -> ByteString
getARIA128SecretKey (ARIA128SecretKey ByteString
bs) = ByteString
bs

type ARIA128SecretKey = SecretKey ARIA128

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

pattern ARIA128Ciphertext :: ByteString -> Ciphertext ARIA128
pattern $mARIA128Ciphertext :: forall {r}.
Ciphertext ARIA128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA128Ciphertext :: ByteString -> Ciphertext ARIA128
ARIA128Ciphertext bs = MkARIA128Ciphertext (MkGCiphertext bs)

getARIA128Ciphertext :: Ciphertext ARIA128 -> ByteString
getARIA128Ciphertext :: Ciphertext ARIA128 -> ByteString
getARIA128Ciphertext (ARIA128Ciphertext ByteString
bs) = ByteString
bs

type ARIA128Ciphertext = Ciphertext ARIA128

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

pattern ARIA128LazyCiphertext :: Lazy.ByteString -> LazyCiphertext ARIA128
pattern $mARIA128LazyCiphertext :: forall {r}.
LazyCiphertext ARIA128 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA128LazyCiphertext :: ByteString -> LazyCiphertext ARIA128
ARIA128LazyCiphertext lbs = MkARIA128LazyCiphertext (MkGLazyCiphertext lbs)

getARIA128LazyCiphertext :: LazyCiphertext ARIA128 -> Lazy.ByteString
getARIA128LazyCiphertext :: LazyCiphertext ARIA128 -> ByteString
getARIA128LazyCiphertext (ARIA128LazyCiphertext ByteString
bs) = ByteString
bs

type ARIA128LazyCiphertext = LazyCiphertext ARIA128

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

instance (MonadRandomIO m )=> SecretKeyGen ARIA128 m where

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

instance HasCiphertext ARIA128 where

instance BlockCipher ARIA128 where

    blockCipherEncrypt :: SecretKey ARIA128 -> ByteString -> Maybe (Ciphertext ARIA128)
    blockCipherEncrypt :: SecretKey ARIA128 -> ByteString -> Maybe (Ciphertext ARIA128)
blockCipherEncrypt (ARIA128SecretKey ByteString
k) = (ByteString -> Ciphertext ARIA128)
-> Maybe ByteString -> Maybe (Ciphertext ARIA128)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext ARIA128
ARIA128Ciphertext (Maybe ByteString -> Maybe (Ciphertext ARIA128))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext ARIA128)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.aria128 ByteString
k

    blockCipherDecrypt :: SecretKey ARIA128 -> Ciphertext ARIA128 -> Maybe ByteString
    blockCipherDecrypt :: SecretKey ARIA128 -> Ciphertext ARIA128 -> Maybe ByteString
blockCipherDecrypt (ARIA128SecretKey ByteString
k) (ARIA128Ciphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.aria128 ByteString
k ByteString
ct

instance HasLazyCiphertext ARIA128 where

instance IncrementalBlockCipher ARIA128 where

    blockCipherEncryptLazy :: SecretKey ARIA128 -> Lazy.ByteString -> Maybe (LazyCiphertext ARIA128)
    blockCipherEncryptLazy :: SecretKey ARIA128 -> ByteString -> Maybe (LazyCiphertext ARIA128)
blockCipherEncryptLazy (ARIA128SecretKey ByteString
k) = (ByteString -> LazyCiphertext ARIA128)
-> Maybe ByteString -> Maybe (LazyCiphertext ARIA128)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext ARIA128
ARIA128LazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext ARIA128))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext ARIA128)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.aria128 ByteString
k

    blockCipherDecryptLazy :: SecretKey ARIA128 -> LazyCiphertext ARIA128 -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey ARIA128 -> LazyCiphertext ARIA128 -> Maybe ByteString
blockCipherDecryptLazy (ARIA128SecretKey ByteString
k) (ARIA128LazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.aria128 ByteString
k ByteString
ct

-- ARIA blockCipher

aria128Encrypt :: SecretKey ARIA128 -> ByteString -> Maybe ARIA128Ciphertext
aria128Encrypt :: SecretKey ARIA128 -> ByteString -> Maybe (Ciphertext ARIA128)
aria128Encrypt = SecretKey ARIA128 -> ByteString -> Maybe (Ciphertext ARIA128)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

aria128Decrypt :: SecretKey ARIA128 -> ARIA128Ciphertext -> Maybe ByteString
aria128Decrypt :: SecretKey ARIA128 -> Ciphertext ARIA128 -> Maybe ByteString
aria128Decrypt = SecretKey ARIA128 -> Ciphertext ARIA128 -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

aria128EncryptLazy :: SecretKey ARIA128 -> Lazy.ByteString -> Maybe ARIA128LazyCiphertext
aria128EncryptLazy :: SecretKey ARIA128 -> ByteString -> Maybe (LazyCiphertext ARIA128)
aria128EncryptLazy = SecretKey ARIA128 -> ByteString -> Maybe (LazyCiphertext ARIA128)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

aria128DecryptLazy :: SecretKey ARIA128 -> ARIA128LazyCiphertext -> Maybe Lazy.ByteString
aria128DecryptLazy :: SecretKey ARIA128 -> LazyCiphertext ARIA128 -> Maybe ByteString
aria128DecryptLazy = SecretKey ARIA128 -> LazyCiphertext ARIA128 -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy

-- ARIA192 type

data ARIA192

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

pattern ARIA192SecretKey :: ByteString -> SecretKey ARIA192
pattern $mARIA192SecretKey :: forall {r}.
SecretKey ARIA192 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA192SecretKey :: ByteString -> SecretKey ARIA192
ARIA192SecretKey bytes = MkARIA192SecretKey (MkGSecretKey bytes)

getARIA192SecretKey :: SecretKey ARIA192 -> ByteString
getARIA192SecretKey :: SecretKey ARIA192 -> ByteString
getARIA192SecretKey (ARIA192SecretKey ByteString
bs) = ByteString
bs

type ARIA192SecretKey = SecretKey ARIA192

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

pattern ARIA192Ciphertext :: ByteString -> Ciphertext ARIA192
pattern $mARIA192Ciphertext :: forall {r}.
Ciphertext ARIA192 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA192Ciphertext :: ByteString -> Ciphertext ARIA192
ARIA192Ciphertext bs = MkARIA192Ciphertext (MkGCiphertext bs)

getARIA192Ciphertext :: Ciphertext ARIA192 -> ByteString
getARIA192Ciphertext :: Ciphertext ARIA192 -> ByteString
getARIA192Ciphertext (ARIA192Ciphertext ByteString
bs) = ByteString
bs

type ARIA192Ciphertext = Ciphertext ARIA192

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

pattern ARIA192LazyCiphertext :: Lazy.ByteString -> LazyCiphertext ARIA192
pattern $mARIA192LazyCiphertext :: forall {r}.
LazyCiphertext ARIA192 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA192LazyCiphertext :: ByteString -> LazyCiphertext ARIA192
ARIA192LazyCiphertext lbs = MkARIA192LazyCiphertext (MkGLazyCiphertext lbs)

getARIA192LazyCiphertext :: LazyCiphertext ARIA192 -> Lazy.ByteString
getARIA192LazyCiphertext :: LazyCiphertext ARIA192 -> ByteString
getARIA192LazyCiphertext (ARIA192LazyCiphertext ByteString
bs) = ByteString
bs

type ARIA192LazyCiphertext = LazyCiphertext ARIA192

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

instance (MonadRandomIO m )=> SecretKeyGen ARIA192 m where

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

instance HasCiphertext ARIA192 where

instance BlockCipher ARIA192 where

    blockCipherEncrypt :: SecretKey ARIA192 -> ByteString -> Maybe (Ciphertext ARIA192)
    blockCipherEncrypt :: SecretKey ARIA192 -> ByteString -> Maybe (Ciphertext ARIA192)
blockCipherEncrypt (ARIA192SecretKey ByteString
k) = (ByteString -> Ciphertext ARIA192)
-> Maybe ByteString -> Maybe (Ciphertext ARIA192)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext ARIA192
ARIA192Ciphertext (Maybe ByteString -> Maybe (Ciphertext ARIA192))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext ARIA192)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.aria192 ByteString
k

    blockCipherDecrypt :: SecretKey ARIA192 -> Ciphertext ARIA192 -> Maybe ByteString
    blockCipherDecrypt :: SecretKey ARIA192 -> Ciphertext ARIA192 -> Maybe ByteString
blockCipherDecrypt (ARIA192SecretKey ByteString
k) (ARIA192Ciphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.aria192 ByteString
k ByteString
ct

instance HasLazyCiphertext ARIA192 where

instance IncrementalBlockCipher ARIA192 where

    blockCipherEncryptLazy :: SecretKey ARIA192 -> Lazy.ByteString -> Maybe (LazyCiphertext ARIA192)
    blockCipherEncryptLazy :: SecretKey ARIA192 -> ByteString -> Maybe (LazyCiphertext ARIA192)
blockCipherEncryptLazy (ARIA192SecretKey ByteString
k) = (ByteString -> LazyCiphertext ARIA192)
-> Maybe ByteString -> Maybe (LazyCiphertext ARIA192)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext ARIA192
ARIA192LazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext ARIA192))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext ARIA192)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.aria192 ByteString
k

    blockCipherDecryptLazy :: SecretKey ARIA192 -> LazyCiphertext ARIA192 -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey ARIA192 -> LazyCiphertext ARIA192 -> Maybe ByteString
blockCipherDecryptLazy (ARIA192SecretKey ByteString
k) (ARIA192LazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.aria192 ByteString
k ByteString
ct

-- ARIA blockCipher

aria192Encrypt :: SecretKey ARIA192 -> ByteString -> Maybe ARIA192Ciphertext
aria192Encrypt :: SecretKey ARIA192 -> ByteString -> Maybe (Ciphertext ARIA192)
aria192Encrypt = SecretKey ARIA192 -> ByteString -> Maybe (Ciphertext ARIA192)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

aria192Decrypt :: SecretKey ARIA192 -> ARIA192Ciphertext -> Maybe ByteString
aria192Decrypt :: SecretKey ARIA192 -> Ciphertext ARIA192 -> Maybe ByteString
aria192Decrypt = SecretKey ARIA192 -> Ciphertext ARIA192 -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

aria192EncryptLazy :: SecretKey ARIA192 -> Lazy.ByteString -> Maybe ARIA192LazyCiphertext
aria192EncryptLazy :: SecretKey ARIA192 -> ByteString -> Maybe (LazyCiphertext ARIA192)
aria192EncryptLazy = SecretKey ARIA192 -> ByteString -> Maybe (LazyCiphertext ARIA192)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

aria192DecryptLazy :: SecretKey ARIA192 -> ARIA192LazyCiphertext -> Maybe Lazy.ByteString
aria192DecryptLazy :: SecretKey ARIA192 -> LazyCiphertext ARIA192 -> Maybe ByteString
aria192DecryptLazy = SecretKey ARIA192 -> LazyCiphertext ARIA192 -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy

-- ARIA256 type

data ARIA256

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

pattern ARIA256SecretKey :: ByteString -> SecretKey ARIA256
pattern $mARIA256SecretKey :: forall {r}.
SecretKey ARIA256 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA256SecretKey :: ByteString -> SecretKey ARIA256
ARIA256SecretKey bytes = MkARIA256SecretKey (MkGSecretKey bytes)

getARIA256SecretKey :: SecretKey ARIA256 -> ByteString
getARIA256SecretKey :: SecretKey ARIA256 -> ByteString
getARIA256SecretKey (ARIA256SecretKey ByteString
bs) = ByteString
bs

type ARIA256SecretKey = SecretKey ARIA256

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

pattern ARIA256Ciphertext :: ByteString -> Ciphertext ARIA256
pattern $mARIA256Ciphertext :: forall {r}.
Ciphertext ARIA256 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA256Ciphertext :: ByteString -> Ciphertext ARIA256
ARIA256Ciphertext bs = MkARIA256Ciphertext (MkGCiphertext bs)

getARIA256Ciphertext :: Ciphertext ARIA256 -> ByteString
getARIA256Ciphertext :: Ciphertext ARIA256 -> ByteString
getARIA256Ciphertext (ARIA256Ciphertext ByteString
bs) = ByteString
bs

type ARIA256Ciphertext = Ciphertext ARIA256

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

pattern ARIA256LazyCiphertext :: Lazy.ByteString -> LazyCiphertext ARIA256
pattern $mARIA256LazyCiphertext :: forall {r}.
LazyCiphertext ARIA256 -> (ByteString -> r) -> ((# #) -> r) -> r
$bARIA256LazyCiphertext :: ByteString -> LazyCiphertext ARIA256
ARIA256LazyCiphertext lbs = MkARIA256LazyCiphertext (MkGLazyCiphertext lbs)

getARIA256LazyCiphertext :: LazyCiphertext ARIA256 -> Lazy.ByteString
getARIA256LazyCiphertext :: LazyCiphertext ARIA256 -> ByteString
getARIA256LazyCiphertext (ARIA256LazyCiphertext ByteString
bs) = ByteString
bs

type ARIA256LazyCiphertext = LazyCiphertext ARIA256

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

instance (MonadRandomIO m )=> SecretKeyGen ARIA256 m where

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

instance HasCiphertext ARIA256 where

instance BlockCipher ARIA256 where

    blockCipherEncrypt :: SecretKey ARIA256 -> ByteString -> Maybe (Ciphertext ARIA256)
    blockCipherEncrypt :: SecretKey ARIA256 -> ByteString -> Maybe (Ciphertext ARIA256)
blockCipherEncrypt (ARIA256SecretKey ByteString
k) = (ByteString -> Ciphertext ARIA256)
-> Maybe ByteString -> Maybe (Ciphertext ARIA256)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Ciphertext ARIA256
ARIA256Ciphertext (Maybe ByteString -> Maybe (Ciphertext ARIA256))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (Ciphertext ARIA256)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncrypt BlockCipher
Botan.aria256 ByteString
k

    blockCipherDecrypt :: SecretKey ARIA256 -> Ciphertext ARIA256 -> Maybe ByteString
    blockCipherDecrypt :: SecretKey ARIA256 -> Ciphertext ARIA256 -> Maybe ByteString
blockCipherDecrypt (ARIA256SecretKey ByteString
k) (ARIA256Ciphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecrypt BlockCipher
Botan.aria256 ByteString
k ByteString
ct

instance HasLazyCiphertext ARIA256 where

instance IncrementalBlockCipher ARIA256 where

    blockCipherEncryptLazy :: SecretKey ARIA256 -> Lazy.ByteString -> Maybe (LazyCiphertext ARIA256)
    blockCipherEncryptLazy :: SecretKey ARIA256 -> ByteString -> Maybe (LazyCiphertext ARIA256)
blockCipherEncryptLazy (ARIA256SecretKey ByteString
k) = (ByteString -> LazyCiphertext ARIA256)
-> Maybe ByteString -> Maybe (LazyCiphertext ARIA256)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> LazyCiphertext ARIA256
ARIA256LazyCiphertext (Maybe ByteString -> Maybe (LazyCiphertext ARIA256))
-> (ByteString -> Maybe ByteString)
-> ByteString
-> Maybe (LazyCiphertext ARIA256)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherEncryptLazy BlockCipher
Botan.aria256 ByteString
k

    blockCipherDecryptLazy :: SecretKey ARIA256 -> LazyCiphertext ARIA256 -> Maybe Lazy.ByteString
    blockCipherDecryptLazy :: SecretKey ARIA256 -> LazyCiphertext ARIA256 -> Maybe ByteString
blockCipherDecryptLazy (ARIA256SecretKey ByteString
k) (ARIA256LazyCiphertext ByteString
ct) = BlockCipher -> ByteString -> ByteString -> Maybe ByteString
Botan.blockCipherDecryptLazy BlockCipher
Botan.aria256 ByteString
k ByteString
ct

-- ARIA blockCipher

aria256Encrypt :: SecretKey ARIA256 -> ByteString -> Maybe ARIA256Ciphertext
aria256Encrypt :: SecretKey ARIA256 -> ByteString -> Maybe (Ciphertext ARIA256)
aria256Encrypt = SecretKey ARIA256 -> ByteString -> Maybe (Ciphertext ARIA256)
forall bc.
BlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (Ciphertext bc)
blockCipherEncrypt

aria256Decrypt :: SecretKey ARIA256 -> ARIA256Ciphertext -> Maybe ByteString
aria256Decrypt :: SecretKey ARIA256 -> Ciphertext ARIA256 -> Maybe ByteString
aria256Decrypt = SecretKey ARIA256 -> Ciphertext ARIA256 -> Maybe ByteString
forall bc.
BlockCipher bc =>
SecretKey bc -> Ciphertext bc -> Maybe ByteString
blockCipherDecrypt

aria256EncryptLazy :: SecretKey ARIA256 -> Lazy.ByteString -> Maybe ARIA256LazyCiphertext
aria256EncryptLazy :: SecretKey ARIA256 -> ByteString -> Maybe (LazyCiphertext ARIA256)
aria256EncryptLazy = SecretKey ARIA256 -> ByteString -> Maybe (LazyCiphertext ARIA256)
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> ByteString -> Maybe (LazyCiphertext bc)
blockCipherEncryptLazy

aria256DecryptLazy :: SecretKey ARIA256 -> ARIA256LazyCiphertext -> Maybe Lazy.ByteString
aria256DecryptLazy :: SecretKey ARIA256 -> LazyCiphertext ARIA256 -> Maybe ByteString
aria256DecryptLazy = SecretKey ARIA256 -> LazyCiphertext ARIA256 -> Maybe ByteString
forall bc.
IncrementalBlockCipher bc =>
SecretKey bc -> LazyCiphertext bc -> Maybe ByteString
blockCipherDecryptLazy

-- Temporary BlockCipher128 conformance

instance BlockCipher128 ARIA128 where
instance IncrementalBlockCipher128 ARIA128 where
instance BlockCipher128 ARIA192 where
instance IncrementalBlockCipher128 ARIA192 where
instance BlockCipher128 ARIA256 where
instance IncrementalBlockCipher128 ARIA256 where