fJ         ! " # $ % & ' ( ) * + , - . / 0 1 23456789:;<=>?@ABCDEFGHI(c) 2014 Magnus TherningBSD3None+ JKLMNOPQRSTUJKQRST JKLMNOPQRSTU(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.+y_enc $ Data.ByteString.Char8.pack "foobar"("\144\153\153\140\139\156","")Msnd $ y_enc $ Data.ByteString.Char8.pack $ Data.List.take 257 $ repeat '\x13'"\DC3"Decoding function.6y_dec $ Data.ByteString.pack [144,153,153,140,139,156]Right ("foobar","")'y_dec $ 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.&y_dec $ Data.ByteString.Char8.pack "="Right ("","=")Convenient function that calls 3 repeatedly until the whole input data is encoded.A synonym for .VWXVWX(c) 2014 Magnus TherningBSD3None(c) 2012 Magnus TherningBSD3None Encoding function.1xx_encode_part $ Data.ByteString.Char8.pack "foo" ("Naxj","")2xx_encode_part $ Data.ByteString.Char8.pack "foob" ("Naxj","b")&Encoding function for the final block.0xx_encode_final $ Data.ByteString.Char8.pack "r" Just "QU"2xx_encode_final $ Data.ByteString.Char8.pack "foo"NothingDecoding function.2xx_decode_part $ Data.ByteString.Char8.pack "Naxj"Right ("foo","")5xx_decode_part $ Data.ByteString.Char8.pack "NaxjMa3"Right ("foo","Ma3")2xx_decode_part $ Data.ByteString.Char8.pack "Na j"Left ("","Na J") &Decoding function for the final block.2xx_decode_final $ Data.ByteString.Char8.pack "Naw" Just "fo"/xx_decode_final $ Data.ByteString.Char8.pack ""Just ""2xx_decode_final $ Data.ByteString.Char8.pack "Na "Nothing;xx_decode_final $ encode $ Data.ByteString.Char8.pack "foo"Nothing YZ[\]   YZ[\] (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  as is.1uu_encode_part $ Data.ByteString.Char8.pack "foo" ("9F]O","")2uu_encode_part $ 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.0uu_encode_final $ Data.ByteString.Char8.pack "r" Just "<@"6Trying to pass in too large a block result in failure:2uu_encode_final $ 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:2uu_decode_part $ Data.ByteString.Char8.pack "9F]O"Right ("foo","")5uu_decode_part $ Data.ByteString.Char8.pack "9F]O8F$"Right ("foo","8F$"),Failures occur on bad input and result in a Left value:2uu_decode_part $ 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:3uu_decode_final $ Data.ByteString.Char8.pack "9F\\" Just "fo"/uu_decode_final $ Data.ByteString.Char8.pack ""Just ""2uu_decode_final $ Data.ByteString.Char8.pack "9F"NothingABut it must be the encoding of a block that is less than 3 bytes:;uu_decode_final $ encode $ Data.ByteString.Char8.pack "foo"Nothing#Convenience function that combines  and  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  and  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") ^_`ab ^_`ab(c) 2014 Magnus TherningBSD3None(c) 2012 Magnus TherningBSD3None Encoding function.&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.'qp_enc $ Data.ByteString.Char8.pack "=" ("=3D","")Ksnd $ qp_enc $ Data.ByteString.Char8.pack $ Data.List.take 171 $ repeat '='"="Decoding function.,qp_dec $ Data.ByteString.Char8.pack "foobar"Right "foobar"9qp_dec $ 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:)qp_dec $ Data.ByteString.Char8.pack "=3D" Right "=")qp_dec $ Data.ByteString.Char8.pack "=3d" Right "="SIt also allows the input to encode _all_ octets in the hexadecimal representation:*qp_dec $ Data.ByteString.Char8.pack "=20!"Right (" !",""),qp_dec $ Data.ByteString.Char8.pack "=20=21"Right (" !","")A Left0 value is only ever returned on decoding errors.(qp_dec $ Data.ByteString.Char8.pack "=2"Right ("","=2"))qp_dec $ Data.ByteString.Char8.pack "=2g"Left ("","=2g")Convenient function that calls 3 repeatedly until the whole input data is encoded.A synonym for .cdecde(c) 2014 Magnus TherningBSD3None (c) 2012 Magnus TherningBSD3None Encoding function.2Encodes as large a part as possible of the indata.5b85_encode_part $ Data.ByteString.Char8.pack "foobar"("AoDTs","ar")JIt supports special handling of both all-zero groups and all-space groups.3b85_encode_part $ Data.ByteString.Char8.pack " " ("y", "")7b85_encode_part $ Data.ByteString.Char8.pack "\0\0\0\0" ("z", "")&Encoding function for the final block.2b85_encode_final $ Data.ByteString.Char8.pack "ar" Just "@<)"Decoding function.3Decode as large a portion of the input as possible.4b85_decode_part $ Data.ByteString.Char8.pack "AoDTs"Right ("foob","")7b85_decode_part $ Data.ByteString.Char8.pack "AoDTs@<)"Right ("foob","@<)")2b85_decode_part $ 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 $ b85_decode_part $ Data.ByteString.Char8.pack $ Prelude.take 129 $ repeat 'y'"y"&Decoding function for the final block.3b85_decode_final $ Data.ByteString.Char8.pack "@<)" Just "ar"0b85_decode_final $ Data.ByteString.Char8.pack ""Just ""5b85_decode_final $ Data.ByteString.Char8.pack "AoDTs"Nothing #Convenience function that combines  and  to encode a complete string.+encode $ Data.ByteString.Char8.pack "foob""AoDTs"-encode $ Data.ByteString.Char8.pack "foobar" "AoDTs@<)"!#Convenience function that combines  and  to decode a complete string.,decode $ Data.ByteString.Char8.pack "AoDTs""foob"/encode $ Data.ByteString.Char8.pack "AoDTs@<)""foobar" fghij ! ! ! fghij ! (c) 2014 Magnus TherningBSD3None"#"#"#"# (c) 2012 Magnus TherningBSD3None klmno$%&'()$%&'()$%&'() klmno$%&'() (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 - as is.2b64_encode_part $ Data.ByteString.Char8.pack "foo" ("Zm9v","")3b64_encode_part $ Data.ByteString.Char8.pack "foob" ("Zm9v","b")-&Encoding function for the final block./The final block has to have a size less than 3.1b64_encode_final $ Data.ByteString.Char8.pack "r" Just "cg=="6Trying to pass in too large a block result in failure:3b64_encode_final $ 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:3b64_decode_part $ Data.ByteString.Char8.pack "Zm9v"Right ("foo","")7b64_decode_part $ Data.ByteString.Char8.pack "Zm9vYmE="Right ("foo","YmE="),Failures occur on bad input and result in a Left value:3b64_decode_part $ Data.ByteString.Char8.pack "Z=9v"Left ("","Z=9v")/&Decoding function for the final block.-The final block has to have a size of 0 or 4:4b64_decode_final $ Data.ByteString.Char8.pack "Zm8=" Just "fo"0b64_decode_final $ Data.ByteString.Char8.pack ""Just ""3b64_decode_final $ Data.ByteString.Char8.pack "Zm="NothingABut it must be the encoding of a block that is less than 3 bytes:<b64_decode_final $ encode $ Data.ByteString.Char8.pack "foo"Nothing0#Convenience function that combines , and - to encode a complete string.)encode $ Data.ByteString.Char8.pack "foo""Zm9v",encode $ Data.ByteString.Char8.pack "foobar" "Zm9vYmFy"1#Convenience function that combines . and / 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") pqrst,-./01,-./01,-./01 pqrst,-./01(c) 2014 Magnus TherningBSD3None23232323(c) 2012 Magnus TherningBSD3None 4Encoding function.See .5b32h_encode_part $ Data.ByteString.Char8.pack "fooba"("CPNMUOJ1","")6b32h_encode_part $ Data.ByteString.Char8.pack "foobar"("CPNMUOJ1","r")5&Encoding function for the final block.See .2b32h_encode_final $ Data.ByteString.Char8.pack "r"Just "E8======"6b32h_encode_final $ Data.ByteString.Char8.pack "fooba"Nothing6Decoding function.See .8b32h_decode_part $ Data.ByteString.Char8.pack "CPNMUOJ1"Right ("fooba","")@b32h_decode_part $ Data.ByteString.Char8.pack "CPNMUOJ1E8======"Right ("fooba","E8======")8b32h_decode_part $ Data.ByteString.Char8.pack "C=NMUOJ1"Left ("","C=NMUOJ1")7&Decoding function for the final block.See .9b32h_decode_final $ Data.ByteString.Char8.pack "CPNMUOG=" Just "foob"1b32h_decode_final $ Data.ByteString.Char8.pack ""Just ""8b32h_decode_final $ Data.ByteString.Char8.pack "CPNMUO="Nothing?b32h_decode_final $ encode $ Data.ByteString.Char8.pack "fooba"Nothing8#Convenience function that combines 4 and 5 to encode a complete string.+encode $ Data.ByteString.Char8.pack "fooba" "CPNMUOJ1",encode $ Data.ByteString.Char8.pack "foobar""CPNMUOJ1E8======"9#Convenience function that combines 6 and 7 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======") uvwxy456789456789456789 uvwxy456789(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 = as is.4b32_encode_part $ Data.ByteString.Char8.pack "fooba"("MZXW6YTB","")5b32_encode_part $ Data.ByteString.Char8.pack "foobar"("MZXW6YTB","r")=&Encoding function for the final block./The final block has to have a size less than 5.1b32_encode_final $ Data.ByteString.Char8.pack "r"Just "OI======"6Trying to pass in too large a block result in failure:5b32_encode_final $ 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:7b32_decode_part $ Data.ByteString.Char8.pack "MZXW6YTB"Right ("fooba","")?b32_decode_part $ Data.ByteString.Char8.pack "MZXW6YTBOI======"Right ("fooba","OI======"),Failures occur on bad input and result in a Left value:7b32_decode_part $ 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:8b32_decode_final $ Data.ByteString.Char8.pack "MZXW6YQ=" Just "foob"0b32_decode_final $ Data.ByteString.Char8.pack ""Just ""7b32_decode_final $ Data.ByteString.Char8.pack "MZXW6Y="NothingABut it must be the encoding of a block that is less than 5 bytes:>b32_decode_final $ encode $ Data.ByteString.Char8.pack "fooba"Nothing@#Convenience function that combines < and = to encode a complete string.+encode $ Data.ByteString.Char8.pack "fooba" "MZXW6YTB",encode $ Data.ByteString.Char8.pack "foobar""MZXW6YTBOI======"A#Convenience function that combines > and ? 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====") z{|}~<=>?@A<=>?@A<=>?@A z{|}~<=>?@A(c) 2014 Magnus TherningBSD3NoneBCBCBCBC(c) 2012 Magnus TherningBSD3None DEncoding 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.%b16_enc $ Data.ByteString.pack [0x00]"00"-b16_enc $ Data.ByteString.Char8.pack "foobar""666F6F626172"EDecoding 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.)b16_dec $ Data.ByteString.Char8.pack "00"Right ("\NUL","")3b16_dec $ Data.ByteString.Char8.pack "666F6F626172"Right ("foobar","")2b16_dec $ Data.ByteString.Char8.pack "666F6F62617"Right ("fooba","7")3b16_dec $ Data.ByteString.Char8.pack "666F6F62617g"Left ("fooba","g")FA synonym for D.GA synonum for E.DThe encoded stringEFGDEFGDEFGDEFG(c) 2014 Magnus TherningBSD3NoneHIHIHIHI !"#$%&' ( ) * +     , - . /     0 1 2 3  456789::;<=>?@ABCDEFGHIJKGLMNOGPQG R S T U G V W X Y G Z [ \ ] G^_`aGbcdeGfgGh sandi-0.3.2Codec.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_finaly_ency_decencodedecodexx_encode_partxx_encode_finalxx_decode_partxx_decode_finaluu_encode_partuu_encode_finaluu_decode_partuu_decode_finalqp_encqp_decb85_encode_partb85_encode_finalb85_decode_partb85_decode_finalb64u_encode_partb64u_encode_finalb64u_decode_partb64u_decode_finalb64_encode_partb64_encode_finalb64_decode_partb64_decode_finalb32h_encode_partb32h_encode_finalb32h_decode_partb32h_decode_finalb16_encb16_decCodecDecodeException 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_encc_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