-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Data encoding library
--   
--   Reasonably fast data encoding library.
@package sandi
@version 0.5

-- | Implemention of base 16 encoding (hex encoding) as specified in RFC
--   4648 (http://tools.ietf.org/html/rfc4648).
module Codec.Binary.Base16

-- | Encoding function.
--   
--   This function, unlike some other encoding functions in the library,
--   simply cannot fail. Double the length of the input string is allocated
--   for the encoded data, which is guaranteed to hold the result.
--   
--   
--   >>> b16Enc $ Data.ByteString.pack [0x00]
--   "00"
--   
--   
--   
--   >>> b16Enc $ Data.ByteString.Char8.pack "foobar"
--   "666F6F626172"
--   
b16Enc :: ByteString -> ByteString

-- | Decoding function.
--   
--   The returned value on success is Right (<decoded part>,
--   <undecoded part>) (the undecoded part is either a empty or
--   a single byte), and on failure it's Left (<decoded part>,
--   <undecodable part>). Space equal to the length of the input
--   string is allocated, which is more than enough to hold the decoded
--   data.
--   
--   
--   >>> b16Dec $ Data.ByteString.Char8.pack "00"
--   Right ("\NUL","")
--   
--   
--   
--   >>> b16Dec $ Data.ByteString.Char8.pack "666F6F626172"
--   Right ("foobar","")
--   
--   
--   
--   >>> b16Dec $ Data.ByteString.Char8.pack "666F6F62617"
--   Right ("fooba","7")
--   
--   >>> b16Dec $ Data.ByteString.Char8.pack "666F6F62617g"
--   Left ("fooba","g")
--   
b16Dec :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | A synonym for b16_enc.
encode :: ByteString -> ByteString

-- | A synonum for b16_dec.
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implemented as specified in RFC 4648
--   (http://tools.ietf.org/html/rfc4648).
--   
--   Base32 encoding works by expanding blocks of 5 bytes of data into
--   blocks of 8 bytes of data. Finally it also includes a well defined
--   ending of the encoded data to make sure the size of the final block of
--   encoded data is 8 bytes too.
module Codec.Binary.Base32

-- | Encoding function.
--   
--   This function encodes as large a portion of the input as possible and
--   returns the encoded part together with the remaining part. Enough
--   space is allocated for the encoding to make sure that the remaining
--   part is less than 5 bytes long, which means it can be passed to
--   b32_encode_final as is.
--   
--   
--   >>> b32EncodePart $ Data.ByteString.Char8.pack "fooba"
--   ("MZXW6YTB","")
--   
--   >>> b32EncodePart $ Data.ByteString.Char8.pack "foobar"
--   ("MZXW6YTB","r")
--   
b32EncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   The final block has to have a size less than 5.
--   
--   
--   >>> b32EncodeFinal $ Data.ByteString.Char8.pack "r"
--   Just "OI======"
--   
--   
--   Trying to pass in too large a block result in failure:
--   
--   
--   >>> b32EncodeFinal $ Data.ByteString.Char8.pack "fooba"
--   Nothing
--   
b32EncodeFinal :: ByteString -> Maybe ByteString

-- | Decoding function.
--   
--   Decode as large a portion of the input as possible. Enough data is
--   allocated for the output to ensure that the remainder is less than 8
--   bytes in size. Success result in a Right value:
--   
--   
--   >>> b32DecodePart $ Data.ByteString.Char8.pack "MZXW6YTB"
--   Right ("fooba","")
--   
--   >>> b32DecodePart $ Data.ByteString.Char8.pack "MZXW6YTBOI======"
--   Right ("fooba","OI======")
--   
--   
--   Failures occur on bad input and result in a Left value:
--   
--   
--   >>> b32DecodePart $ Data.ByteString.Char8.pack "M=XW6YTB"
--   Left ("","M=XW6YTB")
--   
b32DecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Decoding function for the final block.
--   
--   The final block has to have a size of 0 or 8:
--   
--   
--   >>> b32DecodeFinal $ Data.ByteString.Char8.pack "MZXW6YQ="
--   Just "foob"
--   
--   >>> b32DecodeFinal $ Data.ByteString.Char8.pack ""
--   Just ""
--   
--   >>> b32DecodeFinal $ Data.ByteString.Char8.pack "MZXW6Y="
--   Nothing
--   
--   
--   But it must be the encoding of a block that is less than 5 bytes:
--   
--   
--   >>> b32DecodeFinal $ encode $ Data.ByteString.Char8.pack "fooba"
--   Nothing
--   
b32DecodeFinal :: ByteString -> Maybe ByteString

-- | Convenience function that combines b32_encode_part and
--   b32_encode_final to encode a complete string.
--   
--   
--   >>> encode $ Data.ByteString.Char8.pack "fooba"
--   "MZXW6YTB"
--   
--   >>> encode $ Data.ByteString.Char8.pack "foobar"
--   "MZXW6YTBOI======"
--   
encode :: ByteString -> ByteString

-- | Convenience function that combines b32_decode_part and
--   b32_decode_final to decode a complete string.
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "MZXW6YTB"
--   Right "fooba"
--   
--   >>> decode $ Data.ByteString.Char8.pack "MZXW6YTBOI======"
--   Right "foobar"
--   
--   
--   Failures when decoding returns the decoded part and the remainder:
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "MZXW6YTBOI=0===="
--   Left ("fooba","OI=0====")
--   
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implemented as specified in RFC 4648
--   (http://tools.ietf.org/html/rfc4648).
--   
--   This encoding is closely related to base 32 and so is its
--   implementation, so please refer to Codec.Binary.Base32 for
--   further details.
module Codec.Binary.Base32Hex

-- | Encoding function.
--   
--   See b32_encode_part.
--   
--   
--   >>> b32hEncodePart $ Data.ByteString.Char8.pack "fooba"
--   ("CPNMUOJ1","")
--   
--   >>> b32hEncodePart $ Data.ByteString.Char8.pack "foobar"
--   ("CPNMUOJ1","r")
--   
b32hEncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   See b32_encode_final.
--   
--   
--   >>> b32hEncodeFinal $ Data.ByteString.Char8.pack "r"
--   Just "E8======"
--   
--   >>> b32hEncodeFinal $ Data.ByteString.Char8.pack "fooba"
--   Nothing
--   
b32hEncodeFinal :: ByteString -> Maybe ByteString

-- | Decoding function.
--   
--   See b32_decode_part.
--   
--   
--   >>> b32hDecodePart $ Data.ByteString.Char8.pack "CPNMUOJ1"
--   Right ("fooba","")
--   
--   >>> b32hDecodePart $ Data.ByteString.Char8.pack "CPNMUOJ1E8======"
--   Right ("fooba","E8======")
--   
--   >>> b32hDecodePart $ Data.ByteString.Char8.pack "C=NMUOJ1"
--   Left ("","C=NMUOJ1")
--   
b32hDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Decoding function for the final block.
--   
--   See b32_decode_final.
--   
--   
--   >>> b32hDecodeFinal $ Data.ByteString.Char8.pack "CPNMUOG="
--   Just "foob"
--   
--   >>> b32hDecodeFinal $ Data.ByteString.Char8.pack ""
--   Just ""
--   
--   >>> b32hDecodeFinal $ Data.ByteString.Char8.pack "CPNMUO="
--   Nothing
--   
--   >>> b32hDecodeFinal $ encode $ Data.ByteString.Char8.pack "fooba"
--   Nothing
--   
b32hDecodeFinal :: ByteString -> Maybe ByteString

-- | Convenience function that combines b32h_encode_part and
--   b32h_encode_final to encode a complete string.
--   
--   
--   >>> encode $ Data.ByteString.Char8.pack "fooba"
--   "CPNMUOJ1"
--   
--   >>> encode $ Data.ByteString.Char8.pack "foobar"
--   "CPNMUOJ1E8======"
--   
encode :: ByteString -> ByteString

-- | Convenience function that combines b32h_decode_part and
--   b32h_decode_final to decode a complete string.
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "CPNMUOJ1"
--   Right "fooba"
--   
--   >>> decode $ Data.ByteString.Char8.pack "CPNMUOJ1E8======"
--   Right "foobar"
--   
--   
--   Failures when decoding returns the decoded part and the remainder:
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "CPNMUOJ1=8======"
--   Left ("fooba","=8======")
--   
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implemented as specified in RFC 4648
--   (http://tools.ietf.org/html/rfc4648).
--   
--   Base64 encoding works by expanding blocks of 3 bytes of data into
--   blocks of 4 bytes of data. Finally it also includes a well defined
--   ending of the encoded data to make sure the size of the final block of
--   encoded data is 4 bytes too.
module Codec.Binary.Base64

-- | Encoding function.
--   
--   This function encodes as large a portion of the input as possible and
--   returns the encoded part together with the remaining part. Enough
--   space is allocated for the encoding to make sure that the remaining
--   part is less than 3 bytes long, which means it can be passed to
--   b64_encode_final as is.
--   
--   
--   >>> b64EncodePart $ Data.ByteString.Char8.pack "foo"
--   ("Zm9v","")
--   
--   >>> b64EncodePart $ Data.ByteString.Char8.pack "foob"
--   ("Zm9v","b")
--   
b64EncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   The final block has to have a size less than 3.
--   
--   
--   >>> b64EncodeFinal $ Data.ByteString.Char8.pack "r"
--   Just "cg=="
--   
--   
--   Trying to pass in too large a block result in failure:
--   
--   
--   >>> b64EncodeFinal $ Data.ByteString.Char8.pack "foo"
--   Nothing
--   
b64EncodeFinal :: ByteString -> Maybe ByteString

-- | Decoding function.
--   
--   Decode as large a portion of the input as possible. Enough data is
--   allocated for the output to ensure that the remainder is less than 4
--   bytes in size. Success result in a Right value:
--   
--   
--   >>> b64DecodePart $ Data.ByteString.Char8.pack "Zm9v"
--   Right ("foo","")
--   
--   >>> b64DecodePart $ Data.ByteString.Char8.pack "Zm9vYmE="
--   Right ("foo","YmE=")
--   
--   
--   Failures occur on bad input and result in a Left value:
--   
--   
--   >>> b64DecodePart $ Data.ByteString.Char8.pack "Z=9v"
--   Left ("","Z=9v")
--   
b64DecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Decoding function for the final block.
--   
--   The final block has to have a size of 0 or 4:
--   
--   
--   >>> b64DecodeFinal $ Data.ByteString.Char8.pack "Zm8="
--   Just "fo"
--   
--   >>> b64DecodeFinal $ Data.ByteString.Char8.pack ""
--   Just ""
--   
--   >>> b64DecodeFinal $ Data.ByteString.Char8.pack "Zm="
--   Nothing
--   
--   
--   But it must be the encoding of a block that is less than 3 bytes:
--   
--   
--   >>> b64DecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"
--   Nothing
--   
b64DecodeFinal :: ByteString -> Maybe ByteString

-- | Convenience function that combines b64_encode_part and
--   b64_encode_final to encode a complete string.
--   
--   
--   >>> encode $ Data.ByteString.Char8.pack "foo"
--   "Zm9v"
--   
--   >>> encode $ Data.ByteString.Char8.pack "foobar"
--   "Zm9vYmFy"
--   
encode :: ByteString -> ByteString

-- | Convenience function that combines b64_decode_part and
--   b64_decode_final to decode a complete string.
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "Zm9v"
--   Right "foo"
--   
--   >>> decode $ Data.ByteString.Char8.pack "Zm9vYmFy"
--   Right "foobar"
--   
--   
--   Failures when decoding returns the decoded part and the remainder:
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "Zm9vYm=y"
--   Left ("foo","Ym=y")
--   
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implemented as specified in RFC 4648
--   (http://tools.ietf.org/html/rfc4648).
--   
--   The difference compared to vanilla Base64 encoding is just in two
--   characters. In Base64 the characters /+ are used, and in
--   Base64Url they are replaced by _- respectively.
--   
--   Please refer to Codec.Binary.Base64 for the details of all
--   functions in this module.
module Codec.Binary.Base64Url
b64uEncodePart :: ByteString -> (ByteString, ByteString)
b64uEncodeFinal :: ByteString -> Maybe ByteString
b64uDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)
b64uDecodeFinal :: ByteString -> Maybe ByteString
encode :: ByteString -> ByteString
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implemented as described at
--   http://en.wikipedia.org/wiki/Ascii85.
module Codec.Binary.Base85

-- | Encoding function.
--   
--   Encodes as large a part as possible of the indata.
--   
--   
--   >>> b85EncodePart $ Data.ByteString.Char8.pack "foobar"
--   ("AoDTs","ar")
--   
--   
--   It supports special handling of both all-zero groups and all-space
--   groups.
--   
--   
--   >>> b85EncodePart $ Data.ByteString.Char8.pack "    "
--   ("y", "")
--   
--   >>> b85EncodePart $ Data.ByteString.Char8.pack "\0\0\0\0"
--   ("z", "")
--   
b85EncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   
--   >>> b85EncodeFinal $ Data.ByteString.Char8.pack "ar"
--   Just "@<)"
--   
b85EncodeFinal :: ByteString -> Maybe ByteString

-- | Decoding function.
--   
--   Decode as large a portion of the input as possible.
--   
--   
--   >>> b85DecodePart $ Data.ByteString.Char8.pack "AoDTs"
--   Right ("foob","")
--   
--   >>> b85DecodePart $ Data.ByteString.Char8.pack "AoDTs@<)"
--   Right ("foob","@<)")
--   
--   >>> b85DecodePart $ Data.ByteString.Char8.pack "@<)"
--   Right ("","@<)")
--   
--   
--   At least 512 bytes of data is allocated for the output, but because of
--   the special handling of all-zero and all-space groups it is possible
--   that the space won't be enough. (To be sure to always fit the output
--   one would have to allocate 5 times the length of the input. It seemed
--   a good trade-off to sometimes have to call the function more than once
--   instead.)
--   
--   
--   >>> either snd snd $ b85DecodePart $ Data.ByteString.Char8.pack $ Prelude.take 129 $ repeat 'y'
--   "y"
--   
b85DecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Decoding function for the final block.
--   
--   
--   >>> b85DecodeFinal $ Data.ByteString.Char8.pack "@<)"
--   Just "ar"
--   
--   >>> b85DecodeFinal $ Data.ByteString.Char8.pack ""
--   Just ""
--   
--   >>> b85DecodeFinal $ Data.ByteString.Char8.pack "AoDTs"
--   Nothing
--   
b85DecodeFinal :: ByteString -> Maybe ByteString

-- | Convenience function that combines b85_encode_part and
--   b85_encode_final to encode a complete string.
--   
--   
--   >>> encode  $ Data.ByteString.Char8.pack "foob"
--   "AoDTs"
--   
--   >>> encode  $ Data.ByteString.Char8.pack "foobar"
--   "AoDTs@<)"
--   
encode :: ByteString -> ByteString

-- | Convenience function that combines b85_decode_part and
--   b85_decode_final to decode a complete string.
--   
--   
--   >>> decode  $ Data.ByteString.Char8.pack "AoDTs"
--   "foob"
--   
--   >>> encode  $ Data.ByteString.Char8.pack "AoDTs@<)"
--   "foobar"
--   
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implementation of Quoted-Printable based on RFC 2045
--   (http://tools.ietf.org/html/rfc2045).
module Codec.Binary.QuotedPrintable

-- | Encoding function.
--   
--   This function encodes everything that is passed in, it will not
--   try to guess the native line ending for your architecture. In other
--   words, if you are using this to encode text you need to split it into
--   separate lines before encoding.
--   
--   This function allocates enough space to hold twice the size of the
--   indata (or at least 512 bytes) and then encodes as much as possible of
--   the indata. That means there is a risk that the encoded data won't fit
--   and in that case the second part of the pair contains the remainder of
--   the indata.
--   
--   
--   >>> qpEncode $ Data.ByteString.Char8.pack "="
--   ("=3D","")
--   
--   >>> snd $ qpEncode $ Data.ByteString.Char8.pack $ Data.List.take 171 $ repeat '='
--   "="
--   
--   
--   All space (0x20) and tab (0x9) characters are encoded:
--   
--   
--   >>> qpEncode $ Data.ByteString.Char8.pack " \t"
--   ("=20=09","")
--   
--   
--   Since the input is supposed to have been split prior to calling this
--   function all occurances of CR and LF are encoded.
--   
--   
--   >>> qpEncode $ Data.ByteString.Char8.pack "\n\r\r\n\n\r"
--   ("=0A=0D=0D=0A=0A=0D","")
--   
--   
--   Soft line breaks are inserted as needed
--   
--   
--   >>> qpEncode $ Data.ByteString.Char8.pack "========================="
--   ("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=\r\n=3D","")
--   
qpEncode :: ByteString -> (ByteString, ByteString)

-- | Single line encoding function.
--   
--   Like qpEncode, but without inserting soft line breaks.
qpEncodeSL :: ByteString -> (ByteString, ByteString)

-- | Decoding function.
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "foobar"
--   Right "foobar"
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "1=20+=201=20=3D=202"
--   Right "1 + 1 = 2"
--   
--   
--   The input data is allowed to use lowercase letters in the hexadecimal
--   representation of an octets value, even though the standard says that
--   only uppercase letters may be used:
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=3D"
--   Right "="
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=3d"
--   Right "="
--   
--   
--   It also allows the input to encode _all_ octets in the hexadecimal
--   representation:
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=20!"
--   Right (" !","")
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=20=21"
--   Right (" !","")
--   
--   
--   A Left value is only ever returned on decoding errors.
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=2"
--   Right ("","=2")
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "=2g"
--   Left ("","=2g")
--   
--   
--   Per the specification a CRLF pair is left in, but a single CR or LF is
--   an error.
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "\r\n"
--   Right ("\r\n","")
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "\n"
--   Left ("","\n")
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack "\r"
--   Left ("","\r")
--   
--   
--   the same goes for space and tab characters
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack " \t"
--   Right (" \t","")
--   
--   
--   The function deals properly with soft line breaks.
--   
--   
--   >>> qpDecode $ Data.ByteString.Char8.pack " =\r\n"
--   Right (" ","")
--   
qpDecode :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Convenient function that calls qpEncode repeatedly until the
--   whole input data is encoded.
encode :: ByteString -> ByteString

-- | A synonym for qpDec.
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Uuencoding is notoriously badly specified. This implementation aims at
--   being compatible with the GNU Sharutils
--   (http://www.gnu.org/software/sharutils/).
--   
--   Just like Base64 encoding uuencoding expands blocks of 3 bytes into
--   blocks of 4 bytes. There is however no well defined ending to a piece
--   of encoded data, instead uuencoded data is commonly transferred
--   linewise where each line is prepended with the length of the data in
--   the line.
--   
--   This module currently only deals with the encoding. Chopping the
--   encoded data into lines, and unchopping lines into encoded data is
--   left as an exercise to the reader. (Patches are welcome.)
module Codec.Binary.Uu

-- | Encoding function.
--   
--   This function encodes as large a portion of the input as possible and
--   returns the encoded part together with the remaining part. Enough
--   space is allocated for the encoding to make sure that the remaining
--   part is less than 3 bytes long, which means it can be passed to
--   uu_encode_final as is.
--   
--   
--   >>> uuEncodePart $ Data.ByteString.Char8.pack "foo"
--   ("9F]O","")
--   
--   >>> uuEncodePart $ Data.ByteString.Char8.pack "foob"
--   ("9F]O","b")
--   
uuEncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   The final block has to have a size less than 3.
--   
--   
--   >>> uuEncodeFinal $ Data.ByteString.Char8.pack "r"
--   Just "<@"
--   
--   
--   Trying to pass in too large a block result in failure:
--   
--   
--   >>> uuEncodeFinal $ Data.ByteString.Char8.pack "foo"
--   Nothing
--   
uuEncodeFinal :: ByteString -> Maybe ByteString

-- | Decoding function.
--   
--   Decode as large a portion of the input as possible. Enough data is
--   allocated for the output to ensure that the remainder is less than 4
--   bytes in size. Success result in a Right value:
--   
--   
--   >>> uuDecodePart $ Data.ByteString.Char8.pack "9F]O"
--   Right ("foo","")
--   
--   >>> uuDecodePart $ Data.ByteString.Char8.pack "9F]O8F$"
--   Right ("foo","8F$")
--   
--   
--   Failures occur on bad input and result in a Left value:
--   
--   
--   >>> uuDecodePart $ Data.ByteString.Char8.pack "9F 0"
--   Left ("","9F 0")
--   
uuDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Decoding function for the final block.
--   
--   The final block has to have a size of 0 or 4:
--   
--   
--   >>> uuDecodeFinal $ Data.ByteString.Char8.pack "9F\\"
--   Just "fo"
--   
--   >>> uuDecodeFinal $ Data.ByteString.Char8.pack ""
--   Just ""
--   
--   >>> uuDecodeFinal $ Data.ByteString.Char8.pack "9F¬"
--   Nothing
--   
--   
--   But it must be the encoding of a block that is less than 3 bytes:
--   
--   
--   >>> uuDecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"
--   Nothing
--   
uuDecodeFinal :: ByteString -> Maybe ByteString

-- | Convenience function that combines uu_encode_part and
--   uu_encode_final to encode a complete string.
--   
--   
--   >>> encode $ Data.ByteString.Char8.pack "foo"
--   "9F]O"
--   
--   >>> encode $ Data.ByteString.Char8.pack "foobar"
--   "9F]O8F%R"
--   
encode :: ByteString -> ByteString

-- | Convenience function that combines uu_decode_part and
--   uu_decode_final to decode a complete string.
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "9F]O"
--   Right "foo"
--   
--   >>> decode $ Data.ByteString.Char8.pack "9F]O8F%R"
--   Right "foobar"
--   
--   
--   Failures when decoding returns the decoded part and the remainder:
--   
--   
--   >>> decode $ Data.ByteString.Char8.pack "9F]O8F¬R"
--   Left ("foo","8F\172R")
--   
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | 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.
module Codec.Binary.Xx

-- | Encoding function.
--   
--   
--   >>> xxEncodePart $ Data.ByteString.Char8.pack "foo"
--   ("Naxj","")
--   
--   >>> xxEncodePart $ Data.ByteString.Char8.pack "foob"
--   ("Naxj","b")
--   
xxEncodePart :: ByteString -> (ByteString, ByteString)

-- | Encoding function for the final block.
--   
--   
--   >>> xxEncodeFinal $ Data.ByteString.Char8.pack "r"
--   Just "QU"
--   
--   >>> xxEncodeFinal $ Data.ByteString.Char8.pack "foo"
--   Nothing
--   
xxEncodeFinal :: ByteString -> Maybe ByteString

-- | 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")
--   
xxDecodePart :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | 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
--   
xxDecodeFinal :: ByteString -> Maybe ByteString
encode :: ByteString -> ByteString
decode :: ByteString -> Either (ByteString, ByteString) ByteString

-- | Implementation based on the specification found at
--   http://yence.sourceforge.net/docs/protocol/version1_3_draft.html.
module Codec.Binary.Yenc

-- | Encoding function.
--   
--   This function allocates enough space to hold 20% more than the size of
--   the indata (or at least 512 bytes) and then encodes as much as
--   possible of the indata. That means there is a risk that the encoded
--   data won't fit and in that case the second part of the pair contains
--   the remainder of the indata.
--   
--   
--   >>> yEncode $ Data.ByteString.Char8.pack "foobar"
--   ("\144\153\153\140\139\156","")
--   
--   >>> snd $ yEncode $ Data.ByteString.Char8.pack $ Data.List.take 257 $ repeat '\x13'
--   "\DC3"
--   
yEncode :: ByteString -> (ByteString, ByteString)

-- | Decoding function.
--   
--   
--   >>> yDecode $ Data.ByteString.pack [144,153,153,140,139,156]
--   Right ("foobar","")
--   
--   >>> yDecode $ Data.ByteString.Char8.pack "=}"
--   Right ("\DC3","")
--   
--   
--   A Left value is only ever returned on decoding errors which,
--   due to characteristics of the encoding, can never happen.
--   
--   
--   >>> yDecode $ Data.ByteString.Char8.pack "="
--   Right ("","=")
--   
yDecode :: ByteString -> Either (ByteString, ByteString) (ByteString, ByteString)

-- | Convenient function that calls y_enc repeatedly until the
--   whole input data is encoded.
encode :: ByteString -> ByteString

-- | A synonym for y_dec.
decode :: ByteString -> Either (ByteString, ByteString) ByteString

module Data.Conduit.Codec.QuotedPrintable
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base85
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base64Url
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base64
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base32Hex
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base32
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Base16
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Uu
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Xx
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()

module Data.Conduit.Codec.Yenc
encode :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ()
decode :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => ConduitT ByteString ByteString m ()
