added b62 and b58
This commit is contained in:
parent
3a68686500
commit
9bf938216b
|
@ -13,3 +13,8 @@
|
|||
* UuEncoding
|
||||
* YEncoding
|
||||
* Quoted-Printable
|
||||
|
||||
## 0.3.0.0 -- 2022-05-22
|
||||
|
||||
* Added base62 and base58
|
||||
|
||||
|
|
16
Main.hs
16
Main.hs
|
@ -5,16 +5,19 @@ module Main where
|
|||
import System.Console.CmdArgs
|
||||
import Control.Arrow
|
||||
import Numeric (showHex, showIntAtBase)
|
||||
import Data.Char (intToDigit)
|
||||
import Data.Char (ord, chr)
|
||||
import Data.Text (pack, unpack)
|
||||
import Data.Char (intToDigit, ord, chr)
|
||||
import Data.Maybe (fromJust)
|
||||
import TextShow (toText)
|
||||
import Text.XML.HXT.DOM.Util (stringToHexString, hexStringToInt, intToHexString, charToHexString, decimalStringToInt)
|
||||
import TextShow.Data.Integral (showbBin, showbHex)
|
||||
import Codec.CBOR.Magic (intToWord64)
|
||||
import qualified Data.Either.Unwrap as U
|
||||
import qualified Codec.Binary.Base91 as B91
|
||||
import qualified Codec.Binary.Base85 as B85
|
||||
import qualified Codec.Binary.Base64 as B64
|
||||
import qualified Data.Word.Base62 as B62
|
||||
import qualified Haskoin.Address.Base58 as B58
|
||||
import qualified Codec.Binary.Base32 as B32
|
||||
import qualified Codec.Binary.Base16 as B16
|
||||
import qualified Codec.Binary.QuotedPrintable as QP
|
||||
|
@ -23,6 +26,7 @@ import qualified Codec.Binary.Xx as XX
|
|||
import qualified Codec.Binary.Yenc as Y
|
||||
import qualified Data.Bytes as Bytes
|
||||
import qualified Data.Bytes.Text.Ascii as ASCII
|
||||
import Data.Bytes.Get (getWord64host)
|
||||
import Data.ByteString.UTF8 as BSU -- from utf8-string
|
||||
import qualified Data.ByteString.Char8 as C
|
||||
|
||||
|
@ -63,10 +67,10 @@ dec85 = C.unpack . U.fromRight . B85.decode . BSU.fromString
|
|||
enc85 = C.unpack . B85.encode . BSU.fromString
|
||||
dec64 = C.unpack . U.fromRight . B64.decode . BSU.fromString
|
||||
enc64 = C.unpack . B64.encode . BSU.fromString
|
||||
dec62 = show . B62.decode64 . ASCII.fromString
|
||||
enc62 = show . B62.decode64 . ASCII.fromString
|
||||
dec58 = show
|
||||
enc58 = show
|
||||
dec62 = show . fromJust . B62.decode128 . (Bytes.fromByteString . BSU.fromString)
|
||||
enc62 = C.unpack . BSU.fromString. Bytes.toLatinString . (Bytes.fromByteArray . ( B62.encode64 . (intToWord64 . decimalStringToInt)))
|
||||
dec58 = C.unpack . fromJust . B58.decodeBase58 . pack
|
||||
enc58 = unpack . B58.encodeBase58 . BSU.fromString
|
||||
dec32 = C.unpack . U.fromRight . B32.decode . BSU.fromString
|
||||
enc32 = C.unpack . B32.encode . BSU.fromString
|
||||
dec16 = C.unpack . U.fromRight . B16.decode . BSU.fromString
|
||||
|
|
|
@ -27,6 +27,6 @@ executable based
|
|||
main-is: Main.hs
|
||||
other-modules: MyLib
|
||||
-- other-extensions:
|
||||
build-depends: base ^>=4.13.0.0, based, cmdargs, sandi, base62, base91, utf8-string, bytestring, byteslice, either-unwrap, text-show, hxt
|
||||
build-depends: base ^>=4.13.0.0, based, cmdargs, sandi, base62, base91, utf8-string, bytestring, byteslice, either-unwrap, text-show, hxt,haskoin-core, text, bytes, cborg
|
||||
-- hs-source-dirs:
|
||||
default-language: Haskell2010
|
||||
|
|
Loading…
Reference in New Issue