summaryrefslogtreecommitdiff
path: root/Utility/Base64.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-05 20:24:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-05 20:24:10 -0400
commitc98b5cf36e785cdf2c971eaf9b0329db06b68ef8 (patch)
tree9f7e69b1a57bccdb0ef446035d6579fdd3938fe1 /Utility/Base64.hs
parent6040d8aed17de582f5d5c179040e29c599315e31 (diff)
rename
Diffstat (limited to 'Utility/Base64.hs')
-rw-r--r--Utility/Base64.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Utility/Base64.hs b/Utility/Base64.hs
new file mode 100644
index 000000000..dd739fd4f
--- /dev/null
+++ b/Utility/Base64.hs
@@ -0,0 +1,18 @@
+{- Simple Base64 access
+ -
+ - Copyright 2011 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Utility.Base64 (toB64, fromB64) where
+
+import Codec.Binary.Base64
+import Data.Bits.Utils
+
+toB64 :: String -> String
+toB64 = encode . s2w8
+
+fromB64 :: String -> String
+fromB64 s = maybe bad w82s $ decode s
+ where bad = error "bad base64 encoded data"