diff options
Diffstat (limited to 'Crypto/Cipher/ThomasToVincent.hs')
-rw-r--r-- | Crypto/Cipher/ThomasToVincent.hs | 11 |
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 #-} |
2 | module Crypto.Cipher.ThomasToVincent where | 3 | module Crypto.Cipher.ThomasToVincent where |
3 | 4 | ||
@@ -6,6 +7,10 @@ import Data.Byteable | |||
6 | 7 | ||
7 | import Data.Tagged | 8 | import Data.Tagged |
8 | import qualified Crypto.Classes as Thomas | 9 | import qualified Crypto.Classes as Thomas |
10 | #if ! MIN_VERSION_crypto_api(0,11,0) | ||
11 | import qualified Crypto.Modes as Thomas | ||
12 | #endif | ||
13 | |||
9 | 14 | ||
10 | newtype ThomasToVincent b = ThomasToVincent b | 15 | newtype ThomasToVincent b = ThomasToVincent b |
11 | 16 | ||
@@ -19,6 +24,12 @@ instance Thomas.BlockCipher b => Cipher (ThomasToVincent b) where | |||
19 | instance Thomas.BlockCipher b => BlockCipher (ThomasToVincent b) where | 24 | instance 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 | ||