set base64 lenient decoding
This commit is contained in:
parent
710d710730
commit
01509b35e9
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -1,27 +1,5 @@
|
|||
# Revision history for based
|
||||
|
||||
## 0.1.0.0 -- 2022-05-17
|
||||
## 0.1.0.0 -- YYYY-mm-dd
|
||||
|
||||
* First version. Released on an unsuspecting world.
|
||||
|
||||
## 0.2.0.0 -- 2022-05-19
|
||||
|
||||
* Added the following bases and encodings
|
||||
* Decimal to hex
|
||||
* Hex to decmial
|
||||
* Xxencoding
|
||||
* UuEncoding
|
||||
* YEncoding
|
||||
* Quoted-Printable
|
||||
|
||||
## 0.3.0.0 -- 2022-05-22
|
||||
|
||||
* Added base62 and base58
|
||||
|
||||
## 0.4.0.0 -- 2022-05-22
|
||||
|
||||
* Added the following bases and encodings
|
||||
* Base64 for url
|
||||
* Octal to/from hex
|
||||
* Binary to/from hex
|
||||
|
||||
|
|
13
Main.hs
13
Main.hs
|
@ -16,6 +16,7 @@ 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.ByteString.Base64 as B64L
|
||||
import qualified Codec.Binary.Base64Url as B64U
|
||||
import qualified Network.HTTP.Base as HB
|
||||
import qualified Data.Word.Base62 as B62
|
||||
|
@ -85,7 +86,8 @@ dec91 = C.unpack . B91.decode
|
|||
enc91 = B91.encode . BSU.fromString
|
||||
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
|
||||
-- dec64 = C.unpack . U.fromRight . B64.decode . BSU.fromString
|
||||
dec64 = C.unpack . B64L.decodeLenient . BSU.fromString
|
||||
enc64 = C.unpack . B64.encode . BSU.fromString
|
||||
dec64url = C.unpack . U.fromRight . B64U.decode . BSU.fromString
|
||||
enc64url = C.unpack . B64U.encode . BSU.fromString
|
||||
|
@ -147,7 +149,8 @@ optionHandler Encode{xx=True} = encxx
|
|||
optionHandler Decode{yenc=True} = decy
|
||||
optionHandler Encode{yenc=True} = ency
|
||||
|
||||
decode_ = Decode {
|
||||
decodeMode :: Based
|
||||
decodeMode = Decode {
|
||||
b91 = def &= help "decode base91",
|
||||
b85 = def &= help "decode base85",
|
||||
b64 = def &= help "decode base64",
|
||||
|
@ -166,7 +169,8 @@ decode_ = Decode {
|
|||
yenc = def &= help "decode yEncode"
|
||||
} &= help "Decode chosen base" &=auto
|
||||
|
||||
encode_ = Encode {
|
||||
encodeMode :: Based
|
||||
encodeMode = Encode {
|
||||
b91 = def &= help "encode base91",
|
||||
b85 = def &= help "encode base85",
|
||||
b64 = def &= help "encode base64",
|
||||
|
@ -185,4 +189,5 @@ encode_ = Encode {
|
|||
yenc = def &= help "encode yEncode"
|
||||
} &= help "Encode chosen base"
|
||||
|
||||
main = cmdArgs (modes[decode_, encode_] &= help "Anybased, when Cyberchef simply doesn't cut it.\nTo see every parameter of every mode use --help=all" &= program "based" &= summary "based v0.4") >>= interact . optionHandler
|
||||
main :: IO()
|
||||
main = cmdArgs (modes[decodeMode, encodeMode] &= help "Anybased, when Cyberchef simply doesn't cut it.\nTo see every parameter of every mode use --help=all" &= program "based" &= summary "based v0.4") >>= interact . optionHandler
|
||||
|
|
46
based.cabal
46
based.cabal
|
@ -1,32 +1,42 @@
|
|||
cabal-version: 2.4
|
||||
-- Initial package description 'based.cabal' generated by 'cabal init'.
|
||||
-- For further documentation, see http://haskell.org/cabal/users-guide/
|
||||
|
||||
name: based
|
||||
version: 0.4.1.0
|
||||
-- synopsis:
|
||||
-- description:
|
||||
-- bug-reports:
|
||||
-- license:
|
||||
version: 0.4.2.0
|
||||
license-file: LICENSE
|
||||
-- author:
|
||||
-- maintainer:
|
||||
-- copyright:
|
||||
-- category:
|
||||
extra-source-files: CHANGELOG.md
|
||||
author: Stefan Friese
|
||||
|
||||
library
|
||||
exposed-modules: MyLib
|
||||
-- other-modules:
|
||||
-- other-extensions
|
||||
build-depends: base ^>=4.13.0.0
|
||||
exposed-modules:
|
||||
MyLib
|
||||
other-modules:
|
||||
-- Data.Bytes.Text.Ascii
|
||||
build-depends:
|
||||
base ^>= 4.13.0.0,
|
||||
byteslice == 0.2.6.0,
|
||||
-- hs-source-dirs:
|
||||
default-language: Haskell2010
|
||||
|
||||
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,haskoin-core, text, bytes, cborg, text-latin1,HTTP
|
||||
build-depends:
|
||||
base ^>= 4.13.0.0,
|
||||
cmdargs,
|
||||
sandi,
|
||||
base62,
|
||||
base91,
|
||||
utf8-string,
|
||||
bytestring,
|
||||
byteslice == 0.2.6.0,
|
||||
either-unwrap,
|
||||
text-show,
|
||||
hxt,
|
||||
haskoin-core,
|
||||
text,
|
||||
bytes,
|
||||
cborg,
|
||||
text-latin1,
|
||||
HTTP,
|
||||
base64-bytestring
|
||||
-- hs-source-dirs:
|
||||
default-language: Haskell2010
|
||||
|
|
Loading…
Reference in New Issue