diff options
Diffstat (limited to 'lib/Transforms.hs')
-rw-r--r-- | lib/Transforms.hs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/Transforms.hs b/lib/Transforms.hs index 7a676b0..3e13b1a 100644 --- a/lib/Transforms.hs +++ b/lib/Transforms.hs | |||
@@ -1,4 +1,3 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
2 | {-# LANGUAGE DoAndIfThenElse #-} | 1 | {-# LANGUAGE DoAndIfThenElse #-} |
3 | {-# LANGUAGE OverloadedStrings #-} | 2 | {-# LANGUAGE OverloadedStrings #-} |
4 | {-# LANGUAGE PatternGuards #-} | 3 | {-# LANGUAGE PatternGuards #-} |
@@ -26,20 +25,10 @@ import qualified Data.ByteString as S | |||
26 | import qualified Data.ByteString.Lazy as L | 25 | import qualified Data.ByteString.Lazy as L |
27 | import qualified Data.ByteString.Lazy.Char8 as Char8 | 26 | import qualified Data.ByteString.Lazy.Char8 as Char8 |
28 | import qualified Data.Map.Strict as Map | 27 | import qualified Data.Map.Strict as Map |
29 | #if defined(VERSION_memory) | ||
30 | import qualified Data.ByteString.Char8 as S8 | 28 | import qualified Data.ByteString.Char8 as S8 |
31 | import Data.ByteArray.Encoding | 29 | import Data.ByteArray.Encoding |
32 | #elif defined(VERSION_dataenc) | ||
33 | import qualified Codec.Binary.Base32 as Base32 | ||
34 | import qualified Codec.Binary.Base64 as Base64 | ||
35 | #endif | ||
36 | #if !defined(VERSION_cryptonite) | ||
37 | import qualified Crypto.Hash.SHA1 as SHA1 | ||
38 | import qualified Crypto.Types.PubKey.ECC as ECC | ||
39 | #else | ||
40 | import qualified Crypto.Hash as Vincent | 30 | import qualified Crypto.Hash as Vincent |
41 | import Data.ByteArray (convert) | 31 | import Data.ByteArray (convert) |
42 | #endif | ||
43 | import Data.ASN1.BinaryEncoding ( DER(..) ) | 32 | import Data.ASN1.BinaryEncoding ( DER(..) ) |
44 | import Data.ASN1.Types (toASN1, ASN1Object, fromASN1, ASN1(Start, End, IntVal), ASN1ConstructionType(Sequence) ) | 33 | import Data.ASN1.Types (toASN1, ASN1Object, fromASN1, ASN1(Start, End, IntVal), ASN1ConstructionType(Sequence) ) |
45 | 34 | ||
@@ -665,16 +654,8 @@ derToBase32 :: L.ByteString -> String | |||
665 | derToBase32 = map toLower . base32 . sha1 | 654 | derToBase32 = map toLower . base32 . sha1 |
666 | where | 655 | where |
667 | sha1 :: L.ByteString -> S.ByteString | 656 | sha1 :: L.ByteString -> S.ByteString |
668 | #if !defined(VERSION_cryptonite) | ||
669 | sha1 = SHA1.hashlazy | ||
670 | #else | ||
671 | sha1 x = convert (Vincent.hashlazy x :: Vincent.Digest Vincent.SHA1) | 657 | sha1 x = convert (Vincent.hashlazy x :: Vincent.Digest Vincent.SHA1) |
672 | #endif | ||
673 | #if defined(VERSION_memory) | ||
674 | base32 = S8.unpack . convertToBase Base32 | 658 | base32 = S8.unpack . convertToBase Base32 |
675 | #elif defined(VERSION_dataenc) | ||
676 | base32 = Base32.encode . S.unpack | ||
677 | #endif | ||
678 | 659 | ||
679 | derRSA :: Packet -> Maybe L.ByteString | 660 | derRSA :: Packet -> Maybe L.ByteString |
680 | derRSA rsa = do | 661 | derRSA rsa = do |