aboutsummaryrefslogtreecommitdiff
path: root/Utility/Base64.hs
blob: dd739fd4fbc07c3340b390a271076786b44df879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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"