added usable dec85
This commit is contained in:
parent
68eb560810
commit
d3289e0997
22
Main.hs
22
Main.hs
|
@ -115,24 +115,18 @@ octToInt (x : xs) = x + 8 * octToInt xs
|
||||||
dec91 :: String -> String
|
dec91 :: String -> String
|
||||||
dec91 = C.unpack . B91.decode
|
dec91 = C.unpack . B91.decode
|
||||||
|
|
||||||
-- dec91 :: String -> String
|
|
||||||
-- dec91 input =
|
|
||||||
-- case B91.decode (C.pack input) of
|
|
||||||
-- Right decoded -> C.unpack decoded
|
|
||||||
-- Left errMsg -> "Error: " ++ errMsg
|
|
||||||
-- decoded | C.null decoded -> Left "Failed to decode from Base91"
|
|
||||||
-- | otherwise -> Right (C.unpack decoded)
|
|
||||||
|
|
||||||
enc91 :: String -> String
|
enc91 :: String -> String
|
||||||
enc91 = B91.encode . BSU.fromString
|
enc91 = B91.encode . BSU.fromString
|
||||||
|
|
||||||
-- enc91 :: String -> Either String String
|
-- dec85 = C.unpack . U.fromRight . B85.decode . BSU.fromString
|
||||||
-- enc91 input =
|
dec85 :: String -> String
|
||||||
-- case B91.encode (BSU.fromString input) of
|
dec85 input =
|
||||||
-- encoded | C.null encoded -> Left "Failed to encode to Base91"
|
let decoded = B85.decode (BSU.fromString input)
|
||||||
-- | otherwise -> Right (C.unpack encoded)
|
in case decoded of
|
||||||
|
Right decodedStr -> C.unpack decodedStr
|
||||||
|
Left (decodedStr, _) -> C.unpack decodedStr
|
||||||
|
|
||||||
dec85 = C.unpack . U.fromRight . B85.decode . BSU.fromString
|
enc85 :: String -> String
|
||||||
enc85 = C.unpack . B85.encode . BSU.fromString
|
enc85 = C.unpack . B85.encode . BSU.fromString
|
||||||
|
|
||||||
-- dec64 = C.unpack . B64L.decodeLenient . BSU.fromString
|
-- dec64 = C.unpack . B64L.decodeLenient . BSU.fromString
|
||||||
|
|
Loading…
Reference in New Issue