based/src/Encoding/Base58.hs

19 lines
514 B
Haskell
Raw Normal View History

module Encoding.Base58
( enc58
, dec58
) where
import qualified Data.ByteString.Char8 as C
import Data.ByteString.UTF8 as BSU -- from utf8-string
import qualified Haskoin.Address.Base58 as B58
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.IO as T
dec58 :: String -> String
dec58 input =
maybe "Error decoding Base58.\n" C.unpack (B58.decodeBase58 (T.pack input))
enc58 :: String -> String
enc58 = T.unpack . B58.encodeBase58 . BSU.fromString