diff options
Diffstat (limited to 'Base64.hs')
-rw-r--r-- | Base64.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Base64.hs b/Base64.hs new file mode 100644 index 000000000..cc6346b41 --- /dev/null +++ b/Base64.hs @@ -0,0 +1,20 @@ +{- Simple Base64 access + - + - Copyright 2011 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Base64 (toB64, fromB64) where + +import Codec.Binary.Base64 +import Data.Bits.Utils + +toB64 :: String -> String +toB64 = encode . s2w8 + +fromB64 :: String -> String +fromB64 s = + case decode s of + Nothing -> error "bad base64 encoded data" + Just ws -> w82s ws |