diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-09-26 22:39:29 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-09-26 22:39:29 +0400 |
commit | 13dc0f086d3d8f217a2818a429ac117c97397e9b (patch) | |
tree | 1665dd8607bf4ea336e1092d7a9ad122e2638bd9 /src/Data/ByteString | |
parent | efc54d7c09e4e018c3729f2144a7fade49360f56 (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/Data/ByteString')
-rw-r--r-- | src/Data/ByteString/Base32.hs | 12 |
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 | ||
228 | decW5 :: Word8 -> Word5 | 228 | decW5 :: Word8 -> Word5 |
229 | decW5 !x | 229 | decW5 !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 | ||
237 | decTable :: ForeignPtr Word8 | 239 | decTable :: ForeignPtr Word8 |