summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-09-26 22:39:29 +0400
committerSam T <pxqr.sta@gmail.com>2013-09-26 22:39:29 +0400
commit13dc0f086d3d8f217a2818a429ac117c97397e9b (patch)
tree1665dd8607bf4ea336e1092d7a9ad122e2638bd9 /src
parentefc54d7c09e4e018c3729f2144a7fade49360f56 (diff)
Make decode case insensitive.
> 6. Base 32 Encoding > > The Base 32 encoding is designed to represent arbitrary sequences of > octets in a form that _needs to be case insensitive_ but that need not > be human readable.
Diffstat (limited to 'src')
-rw-r--r--src/Data/ByteString/Base32.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Data/ByteString/Base32.hs b/src/Data/ByteString/Base32.hs
index 5dc025c..a5835ad 100644
--- a/src/Data/ByteString/Base32.hs
+++ b/src/Data/ByteString/Base32.hs
@@ -227,11 +227,13 @@ pack5 !tbl bs @ (PS fptr off sz) =
227 227
228decW5 :: Word8 -> Word5 228decW5 :: Word8 -> Word5
229decW5 !x 229decW5 !x
230 | x < 50 {- c2w '2' -} = invIx 230 | x < 50 {- c2w '2' -} = invIx
231 | x <= 55 {- c2w '7' -} = x - 24 231 | x <= 55 {- c2w '7' -} = x - 24 {- c2w '2' - 26 -}
232 | x < 65 {- c2w 'A' -} = invIx 232 | x < 65 {- c2w 'A' -} = invIx
233 | x <= 90 {- c2w 'Z' -} = x - 65 233 | x <= 90 {- c2w 'Z' -} = x - 65 {- c2w 'A' -}
234 | otherwise = invIx 234 | x < 97 {- c2w 'a' -} = invIx
235 | x <= 122 {- c2w 'z' -} = x - 97 {- c2w 'a' -}
236 | otherwise = invIx
235{-# INLINE decW5 #-} 237{-# INLINE decW5 #-}
236 238
237decTable :: ForeignPtr Word8 239decTable :: ForeignPtr Word8