Copyright | (c) 2012 Magnus Therning |
---|---|
License | BSD3 |
Safe Haskell | None |
Language | Haskell98 |
Xxencoding is obsolete but still included for completeness. Further information on the encoding can be found at http://en.wikipedia.org/wiki/Xxencode. It should be noted that this implementation performs no padding.
This encoding is very similar to uuencoding, therefore further information regarding the functions can be found in the documentation of Codec.Binary.Uu.
- xxEncodePart :: ByteString -> (ByteString, ByteString)
- xxEncodeFinal :: ByteString -> Maybe ByteString
- xxDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)
- xxDecodeFinal :: ByteString -> Maybe ByteString
- encode :: ByteString -> ByteString
- decode :: ByteString -> Either (ByteString, ByteString) ByteString
Documentation
xxEncodePart :: ByteString -> (ByteString, ByteString) Source #
Encoding function.
>>>
xxEncodePart $ Data.ByteString.Char8.pack "foo"
("Naxj","")>>>
xxEncodePart $ Data.ByteString.Char8.pack "foob"
("Naxj","b")
xxEncodeFinal :: ByteString -> Maybe ByteString Source #
Encoding function for the final block.
>>>
xxEncodeFinal $ Data.ByteString.Char8.pack "r"
Just "QU">>>
xxEncodeFinal $ Data.ByteString.Char8.pack "foo"
Nothing
xxDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString) Source #
Decoding function.
>>>
xxDecodePart $ Data.ByteString.Char8.pack "Naxj"
Right ("foo","")>>>
xxDecodePart $ Data.ByteString.Char8.pack "NaxjMa3"
Right ("foo","Ma3")
>>>
xxDecodePart $ Data.ByteString.Char8.pack "Na j"
Left ("","Na J")
xxDecodeFinal :: ByteString -> Maybe ByteString Source #
Decoding function for the final block.
>>>
xxDecodeFinal $ Data.ByteString.Char8.pack "Naw"
Just "fo">>>
xxDecodeFinal $ Data.ByteString.Char8.pack ""
Just "">>>
xxDecodeFinal $ Data.ByteString.Char8.pack "Na "
Nothing
>>>
xxDecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"
Nothing
encode :: ByteString -> ByteString Source #
decode :: ByteString -> Either (ByteString, ByteString) ByteString Source #