EK        ! " # $ % & ' ( ) * + , - . / 0 1 2 3456789:;<=>?@ABCDEFGHIJ(c) 2014 Magnus TherningBSD3Safe0 KLMNOPQRSTUVKLRSTU KLMNOPQRSTUV(c) 2012 Magnus TherningBSD3None 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","")Osnd $ yEncode $ Data.ByteString.Char8.pack $ Data.List.take 257 $ repeat '\x13'"\DC3"Decoding function.8yDecode $ Data.ByteString.pack [144,153,153,140,139,156]Right ("foobar",""))yDecode $ Data.ByteString.Char8.pack "=}"Right ("\DC3","")A Leftq value is only ever returned on decoding errors which, due to characteristics of the encoding, can never happen.(yDecode $ Data.ByteString.Char8.pack "="Right ("","=")Convenient function that calls y_enc3 repeatedly until the whole input data is encoded.A synonym for y_dec.WXYWXY(c) 2014 Magnus TherningBSD3None(c) 2012 Magnus TherningBSD3None Encoding function./xxEncodePart $ Data.ByteString.Char8.pack "foo" ("Naxj","")0xxEncodePart $ Data.ByteString.Char8.pack "foob" ("Naxj","b")&Encoding function for the final block..xxEncodeFinal $ Data.ByteString.Char8.pack "r" Just "QU"0xxEncodeFinal $ Data.ByteString.Char8.pack "foo"NothingDecoding function.0xxDecodePart $ Data.ByteString.Char8.pack "Naxj"Right ("foo","")3xxDecodePart $ Data.ByteString.Char8.pack "NaxjMa3"Right ("foo","Ma3")0xxDecodePart $ Data.ByteString.Char8.pack "Na j"Left ("","Na J") &Decoding function for the final block.0xxDecodeFinal $ Data.ByteString.Char8.pack "Naw" Just "fo"-xxDecodeFinal $ Data.ByteString.Char8.pack ""Just ""0xxDecodeFinal $ Data.ByteString.Char8.pack "Na "Nothing9xxDecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"Nothing Z[\]^   Z[\]^ (c) 2014 Magnus TherningBSD3None    (c) 2012 Magnus TherningBSD3None 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","")0uuEncodePart $ Data.ByteString.Char8.pack "foob" ("9F]O","b")&Encoding function for the final block./The final block has to have a size less than 3..uuEncodeFinal $ Data.ByteString.Char8.pack "r" Just "<@"6Trying to pass in too large a block result in failure:0uuEncodeFinal $ Data.ByteString.Char8.pack "foo"NothingDecoding 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:0uuDecodePart $ Data.ByteString.Char8.pack "9F]O"Right ("foo","")3uuDecodePart $ Data.ByteString.Char8.pack "9F]O8F$"Right ("foo","8F$"),Failures occur on bad input and result in a Left value:0uuDecodePart $ Data.ByteString.Char8.pack "9F 0"Left ("","9F 0")&Decoding function for the final block.-The final block has to have a size of 0 or 4:1uuDecodeFinal $ Data.ByteString.Char8.pack "9F\\" Just "fo"-uuDecodeFinal $ Data.ByteString.Char8.pack ""Just ""0uuDecodeFinal $ Data.ByteString.Char8.pack "9F"NothingABut it must be the encoding of a block that is less than 3 bytes:9uuDecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"Nothing#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"#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"BFailures when decoding returns the decoded part and the remainder:.decode $ Data.ByteString.Char8.pack "9F]O8FR"Left ("foo","8F\172R") _`abc _`abc(c) 2014 Magnus TherningBSD3None(c) 2012 Magnus TherningBSD3None 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","")Msnd $ qpEncode $ Data.ByteString.Char8.pack $ Data.List.take 171 $ repeat '='"="6All space (0x20) and tab (0x9) characters are encoded:+qpEncode $ Data.ByteString.Char8.pack " \t" ("=20=09","")wSince the input is supposed to have been split prior to calling this function all occurances of CR and LF are encoded.4qpEncode $ Data.ByteString.Char8.pack "\n\r\r\n\n\r"("=0A=0D=0D=0A=0A=0D","")'Soft line breaks are inserted as neededAqpEncode $ Data.ByteString.Char8.pack "========================="W("=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","")Single line encoding function.Like ), but without inserting soft line breaks.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 "="SIt 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 Left0 value is only ever returned on decoding errors.*qpDecode $ Data.ByteString.Char8.pack "=2"Right ("","=2")+qpDecode $ Data.ByteString.Char8.pack "=2g"Left ("","=2g")QPer 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","")2The function deals properly with soft line breaks..qpDecode $ Data.ByteString.Char8.pack " =\r\n"Right (" ","")Convenient function that calls 3 repeatedly until the whole input data is encoded.A synonym for qpDec. defg defg(c) 2014 Magnus TherningBSD3None (c) 2012 Magnus TherningBSD3None Encoding function.2Encodes as large a part as possible of the indata.3b85EncodePart $ Data.ByteString.Char8.pack "foobar"("AoDTs","ar")JIt supports special handling of both all-zero groups and all-space groups.1b85EncodePart $ Data.ByteString.Char8.pack " " ("y", "")5b85EncodePart $ Data.ByteString.Char8.pack "\0\0\0\0" ("z", "")&Encoding function for the final block.0b85EncodeFinal $ Data.ByteString.Char8.pack "ar" Just "@<)"Decoding function.3Decode as large a portion of the input as possible.2b85DecodePart $ Data.ByteString.Char8.pack "AoDTs"Right ("foob","")5b85DecodePart $ Data.ByteString.Char8.pack "AoDTs@<)"Right ("foob","@<)")0b85DecodePart $ Data.ByteString.Char8.pack "@<)"Right ("","@<)")mAt 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" &Decoding function for the final block.1b85DecodeFinal $ Data.ByteString.Char8.pack "@<)" Just "ar".b85DecodeFinal $ Data.ByteString.Char8.pack ""Just ""3b85DecodeFinal $ Data.ByteString.Char8.pack "AoDTs"Nothing!#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@<)""#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" hijkl !" !" !" hijkl !" (c) 2014 Magnus TherningBSD3None#$#$#$#$ (c) 2012 Magnus TherningBSD3None mnopq%&'()*%&'()*%&'()* mnopq%&'()* (c) 2014 Magnus TherningBSD3None+,+,+,+, (c) 2012 Magnus TherningBSD3None -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.0b64EncodePart $ Data.ByteString.Char8.pack "foo" ("Zm9v","")1b64EncodePart $ Data.ByteString.Char8.pack "foob" ("Zm9v","b").&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=="6Trying to pass in too large a block result in failure:1b64EncodeFinal $ Data.ByteString.Char8.pack "foo"Nothing/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:1b64DecodePart $ Data.ByteString.Char8.pack "Zm9v"Right ("foo","")5b64DecodePart $ Data.ByteString.Char8.pack "Zm9vYmE="Right ("foo","YmE="),Failures occur on bad input and result in a Left value:1b64DecodePart $ Data.ByteString.Char8.pack "Z=9v"Left ("","Z=9v")0&Decoding function for the final block.-The final block has to have a size of 0 or 4:2b64DecodeFinal $ Data.ByteString.Char8.pack "Zm8=" Just "fo".b64DecodeFinal $ Data.ByteString.Char8.pack ""Just ""1b64DecodeFinal $ Data.ByteString.Char8.pack "Zm="NothingABut it must be the encoding of a block that is less than 3 bytes::b64DecodeFinal $ encode $ Data.ByteString.Char8.pack "foo"Nothing1#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"2#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"BFailures when decoding returns the decoded part and the remainder:.decode $ Data.ByteString.Char8.pack "Zm9vYm=y"Left ("foo","Ym=y") rstuv-./012-./012-./012 rstuv-./012(c) 2014 Magnus TherningBSD3None34343434(c) 2012 Magnus TherningBSD3None 5Encoding function.See .3b32hEncodePart $ Data.ByteString.Char8.pack "fooba"("CPNMUOJ1","")4b32hEncodePart $ Data.ByteString.Char8.pack "foobar"("CPNMUOJ1","r")6&Encoding function for the final block.See .0b32hEncodeFinal $ Data.ByteString.Char8.pack "r"Just "E8======"4b32hEncodeFinal $ Data.ByteString.Char8.pack "fooba"Nothing7Decoding function.See .6b32hDecodePart $ Data.ByteString.Char8.pack "CPNMUOJ1"Right ("fooba","")>b32hDecodePart $ Data.ByteString.Char8.pack "CPNMUOJ1E8======"Right ("fooba","E8======")6b32hDecodePart $ Data.ByteString.Char8.pack "C=NMUOJ1"Left ("","C=NMUOJ1")8&Decoding function for the final block.See .7b32hDecodeFinal $ Data.ByteString.Char8.pack "CPNMUOG=" Just "foob"/b32hDecodeFinal $ Data.ByteString.Char8.pack ""Just ""6b32hDecodeFinal $ Data.ByteString.Char8.pack "CPNMUO="Nothing=b32hDecodeFinal $ encode $ Data.ByteString.Char8.pack "fooba"Nothing9#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======":#Convenience function that combines b32h_decode_part and b32h_decode_final to decode a complete string..decode $ Data.ByteString.Char8.pack "CPNMUOJ1" Right "fooba"6decode $ Data.ByteString.Char8.pack "CPNMUOJ1E8======"Right "foobar"BFailures when decoding returns the decoded part and the remainder:6decode $ Data.ByteString.Char8.pack "CPNMUOJ1=8======"Left ("fooba","=8======") wxyz{56789:56789:56789: wxyz{56789:(c) 2014 Magnus TherningBSD3None;<;<;<;<(c) 2012 Magnus TherningBSD3None =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.2b32EncodePart $ Data.ByteString.Char8.pack "fooba"("MZXW6YTB","")3b32EncodePart $ Data.ByteString.Char8.pack "foobar"("MZXW6YTB","r")>&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======"6Trying to pass in too large a block result in failure:3b32EncodeFinal $ Data.ByteString.Char8.pack "fooba"Nothing?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:5b32DecodePart $ 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:5b32DecodePart $ Data.ByteString.Char8.pack "M=XW6YTB"Left ("","M=XW6YTB")@&Decoding function for the final block.-The final block has to have a size of 0 or 8:6b32DecodeFinal $ Data.ByteString.Char8.pack "MZXW6YQ=" Just "foob".b32DecodeFinal $ Data.ByteString.Char8.pack ""Just ""5b32DecodeFinal $ Data.ByteString.Char8.pack "MZXW6Y="NothingABut it must be the encoding of a block that is less than 5 bytes:<b32DecodeFinal $ encode $ Data.ByteString.Char8.pack "fooba"NothingA#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======"B#Convenience function that combines b32_decode_part and b32_decode_final to decode a complete string..decode $ Data.ByteString.Char8.pack "MZXW6YTB" Right "fooba"6decode $ Data.ByteString.Char8.pack "MZXW6YTBOI======"Right "foobar"BFailures when decoding returns the decoded part and the remainder:6decode $ Data.ByteString.Char8.pack "MZXW6YTBOI=0===="Left ("fooba","OI=0====") |}~=>?@AB=>?@AB=>?@AB |}~=>?@AB(c) 2014 Magnus TherningBSD3NoneCDCDCDCD(c) 2012 Magnus TherningBSD3None EEncoding 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"FDecoding function.!The returned value on success is )Right (<decoded part>, <undecoded part>)O (the undecoded part is either a empty or a single byte), and on failure it's )Left (<decoded part>, <undecodable part>)t. 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","")2b16Dec $ Data.ByteString.Char8.pack "666F6F626172"Right ("foobar","")1b16Dec $ Data.ByteString.Char8.pack "666F6F62617"Right ("fooba","7")2b16Dec $ Data.ByteString.Char8.pack "666F6F62617g"Left ("fooba","g")GA synonym for b16_enc.HA synonum for b16_dec.EThe encoded stringFGHEFGHEFGHEFGH(c) 2014 Magnus TherningBSD3NoneIJIJIJIJ !"#$%&'( ) * + ,     - . / 0     1 2 3 4  56789:;<=>??@ABCDEFGHIJKLMNOPLQRSTLUVLW X Y Z [ L \ ] ^ _ L ` a b c LdefgLhijkLlmLn"sandi-0.4.0-E1jQhZ8NwlxBKxdiTgLZaECodec.Binary.YencData.Conduit.Codec.YencCodec.Binary.XxData.Conduit.Codec.XxCodec.Binary.UuData.Conduit.Codec.UuCodec.Binary.QuotedPrintable"Data.Conduit.Codec.QuotedPrintableCodec.Binary.Base85Data.Conduit.Codec.Base85Codec.Binary.Base64UrlData.Conduit.Codec.Base64UrlCodec.Binary.Base64Data.Conduit.Codec.Base64Codec.Binary.Base32HexData.Conduit.Codec.Base32HexCodec.Binary.Base32Data.Conduit.Codec.Base32Codec.Binary.Base16Data.Conduit.Codec.Base16Data.Conduit.Codec.Utilb32_encode_partb32_encode_finalb32_decode_partb32_decode_finalyEncodeyDecodeencodedecode xxEncodePart xxEncodeFinal xxDecodePart xxDecodeFinal uuEncodePart uuEncodeFinal uuDecodePart uuDecodeFinalqpEncode qpEncodeSLqpDecode b85EncodePartb85EncodeFinal b85DecodePartb85DecodeFinalb64uEncodePartb64uEncodeFinalb64uDecodePartb64uDecodeFinal b64EncodePartb64EncodeFinal b64DecodePartb64DecodeFinalb32hEncodePartb32hEncodeFinalb32hDecodePartb32hDecodeFinal b32EncodePartb32EncodeFinal b32DecodePartb32DecodeFinalb16Encb16DecCodecDecodeException DecFuncFinalDecFunc EncFuncFinal EncFuncPartEncFuncencodeIdecodeIencodeIIdecodeII$fExceptionCodecDecodeExceptionc_y_decc_y_enccastEnumc_xx_dec_final c_xx_dec_partc_xx_enc_final c_xx_enc_partc_uu_dec_final c_uu_dec_partc_uu_enc_final c_uu_enc_partc_qp_decc_qp_encqpEnc'c_b85_dec_finalc_b85_dec_partc_b85_enc_finalc_b85_enc_partc_b64u_dec_finalc_b64u_dec_partc_b64u_enc_finalc_b64u_enc_partc_b64_dec_finalc_b64_dec_partc_b64_enc_finalc_b64_enc_partc_b32h_dec_finalc_b32h_dec_partc_b32h_enc_finalc_b32h_enc_partc_b32_dec_finalc_b32_dec_partc_b32_enc_finalc_b32_enc_part c_b16_dec c_b16_enc