summaryrefslogtreecommitdiff
path: root/Crypto/Cipher/ThomasToVincent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Crypto/Cipher/ThomasToVincent.hs')
-rw-r--r--Crypto/Cipher/ThomasToVincent.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Crypto/Cipher/ThomasToVincent.hs b/Crypto/Cipher/ThomasToVincent.hs
index 85b0875..11cede3 100644
--- a/Crypto/Cipher/ThomasToVincent.hs
+++ b/Crypto/Cipher/ThomasToVincent.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE ScopedTypeVariables #-} 2{-# LANGUAGE ScopedTypeVariables #-}
2module Crypto.Cipher.ThomasToVincent where 3module Crypto.Cipher.ThomasToVincent where
3 4
@@ -6,6 +7,10 @@ import Data.Byteable
6 7
7import Data.Tagged 8import Data.Tagged
8import qualified Crypto.Classes as Thomas 9import qualified Crypto.Classes as Thomas
10#if ! MIN_VERSION_crypto_api(0,11,0)
11import qualified Crypto.Modes as Thomas
12#endif
13
9 14
10newtype ThomasToVincent b = ThomasToVincent b 15newtype ThomasToVincent b = ThomasToVincent b
11 16
@@ -19,6 +24,12 @@ instance Thomas.BlockCipher b => Cipher (ThomasToVincent b) where
19instance Thomas.BlockCipher b => BlockCipher (ThomasToVincent b) where 24instance Thomas.BlockCipher b => BlockCipher (ThomasToVincent b) where
20 blockSize _ = bitlen `div` 8 25 blockSize _ = bitlen `div` 8
21 where Tagged bitlen = Thomas.blockSize :: Tagged b Int 26 where Tagged bitlen = Thomas.blockSize :: Tagged b Int
27#if ! MIN_VERSION_crypto_api(0,11,0)
28 ecbEncrypt (ThomasToVincent k) = Thomas.ecb' k
29 ecbDecrypt (ThomasToVincent k) = Thomas.unEcb' k
30#else
22 ecbEncrypt (ThomasToVincent k) = Thomas.ecb k 31 ecbEncrypt (ThomasToVincent k) = Thomas.ecb k
23 ecbDecrypt (ThomasToVincent k) = Thomas.unEcb k 32 ecbDecrypt (ThomasToVincent k) = Thomas.unEcb k
33#endif
34
24 35