summaryrefslogtreecommitdiff
path: root/src/Data/ByteString/Base32.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/ByteString/Base32.hs')
-rw-r--r--src/Data/ByteString/Base32.hs20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/Data/ByteString/Base32.hs b/src/Data/ByteString/Base32.hs
index e9ac3ee..0568c54 100644
--- a/src/Data/ByteString/Base32.hs
+++ b/src/Data/ByteString/Base32.hs
@@ -21,7 +21,6 @@ module Data.ByteString.Base32
21 ) where 21 ) where
22 22
23import Data.ByteString as BS 23import Data.ByteString as BS
24import Data.ByteString.Internal as BS
25import Data.ByteString.Base32.Internal 24import Data.ByteString.Base32.Internal
26import Data.List as L 25import Data.List as L
27 26
@@ -60,23 +59,6 @@ decTable = BS.pack $ L.map decW5 [minBound .. maxBound]
60decode :: Base32 -> ByteString 59decode :: Base32 -> ByteString
61decode = pack5 decTable 60decode = pack5 decTable
62 61
63decCharLenient :: Char -> Word5
64decCharLenient x
65 | x < '2' = err
66 | x <= '7' = 26 + fromIntegral (fromEnum x) - fromIntegral (fromEnum '2')
67 | x < 'A' = err
68 | x <= 'Z' = fromIntegral (fromEnum x) - fromIntegral (fromEnum 'A')
69 | x < 'a' = err
70 | x <= 'z' = fromIntegral (fromEnum x) - fromIntegral (fromEnum 'a')
71 | otherwise = err
72 where
73 err = error "base32: decodeChar: out of range"
74
75decW5Lenient :: Word8 -> Word5
76decW5Lenient = decCharLenient . w2c
77{-# INLINE decW5Lenient #-}
78
79-- TODO padding leniency
80-- | Case-insensitive counterpart of the 'decode'. 62-- | Case-insensitive counterpart of the 'decode'.
81decodeLenient :: Base32 -> ByteString 63decodeLenient :: Base32 -> ByteString
82decodeLenient = id -- pack5 nullPtr decW5Lenient \ No newline at end of file 64decodeLenient = pack5Lenient decTable \ No newline at end of file