úÎ! 0JK      !"#$%&'()*+,- . / 0 1 2 3 4 5 6 7 8 9 : ; < =>?@ABCDEFGHIJ(c) 2012 Magnus TherningBSD3None“sandiEncoding 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"sandiDecoding 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")sandiA synonym for b16_enc.sandiA synonum for b16_dec.sandiThe encoded string(c) 2012 Magnus TherningBSD3None8¶sandiEncoding 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")sandi&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"NothingsandiDecoding 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")sandi&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"Nothingsandi#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======" sandi#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====")  (c) 2012 Magnus TherningBSD3NoneQÏ sandiEncoding function.See .3b32hEncodePart $ Data.ByteString.Char8.pack "fooba"("CPNMUOJ1","")4b32hEncodePart $ Data.ByteString.Char8.pack "foobar"("CPNMUOJ1","r") sandi&Encoding function for the final block.See .0b32hEncodeFinal $ Data.ByteString.Char8.pack "r"Just "E8======"4b32hEncodeFinal $ Data.ByteString.Char8.pack "fooba"Nothing sandiDecoding 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") sandi&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"Nothingsandi#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======"sandi#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======")  (c) 2012 Magnus TherningBSD3NonetrsandiEncoding 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")sandi&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"NothingsandiDecoding 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")sandi&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"Nothingsandi#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"sandi#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")(c) 2012 Magnus TherningBSD3NoneuJ(c) 2012 Magnus TherningBSD3None“sandiEncoding 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", "")sandi&Encoding function for the final block.0b85EncodeFinal $ Data.ByteString.Char8.pack "ar" Just "@<)"sandiDecoding 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"sandi&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 sandi#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@<)"!sandi#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" ! !(c) 2012 Magnus TherningBSD3None¾/"sandiEncoding 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","")#sandiSingle line encoding function.Like "), but without inserting soft line breaks.$sandiDecoding 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 (" ","")%sandiConvenient function that calls "3 repeatedly until the whole input data is encoded.&sandiA synonym for qpDec."#$%&"#$%&(c) 2012 Magnus TherningBSD3Noneà†'sandiEncoding 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")(sandi&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"Nothing)sandiDecoding 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")*sandi&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+sandi#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",sandi#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]O8F¬R"Left ("foo","8F\172R")'()*+,'()*+, (c) 2012 Magnus TherningBSD3Noneî-sandiEncoding function./xxEncodePart $ Data.ByteString.Char8.pack "foo" ("Naxj","")0xxEncodePart $ Data.ByteString.Char8.pack "foob" ("Naxj","b").sandi&Encoding function for the final block..xxEncodeFinal $ Data.ByteString.Char8.pack "r" Just "QU"0xxEncodeFinal $ Data.ByteString.Char8.pack "foo"Nothing/sandiDecoding 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")0sandi&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-./012-./012 (c) 2012 Magnus TherningBSD3NoneýÎ3sandiEncoding 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"4sandiDecoding 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 ("","=")5sandiConvenient function that calls y_enc3 repeatedly until the whole input data is encoded.6sandiA synonym for y_dec.34563456(c) 2014 Magnus TherningBSD3None2þžKLMNOP (c) 2014 Magnus TherningBSD3Noneÿ_7878 (c) 2014 Magnus TherningBSD3None9:9: (c) 2014 Magnus TherningBSD3NoneÏ;<;<(c) 2014 Magnus TherningBSD3None‡=>=>(c) 2014 Magnus TherningBSD3None??@?@(c) 2014 Magnus TherningBSD3None÷ABAB(c) 2014 Magnus TherningBSD3None¯CDCD(c) 2014 Magnus TherningBSD3NonegEFEF(c) 2014 Magnus TherningBSD3NoneGHGH(c) 2014 Magnus TherningBSD3None×IJIJSafe%QRSTUVWXY !"#$%&'()*+,-./0123456789 : ; < =   > ?        @@ABCDEFGHIJKLM sandi-0.5-Enamm4pJgcRLTYFlBSFpOcCodec.Binary.Base16Codec.Binary.Base32Codec.Binary.Base32HexCodec.Binary.Base64Codec.Binary.Base64UrlCodec.Binary.Base85Codec.Binary.QuotedPrintableCodec.Binary.UuCodec.Binary.XxCodec.Binary.Yenc"Data.Conduit.Codec.QuotedPrintableData.Conduit.Codec.Base85Data.Conduit.Codec.Base64UrlData.Conduit.Codec.Base64Data.Conduit.Codec.Base32HexData.Conduit.Codec.Base32Data.Conduit.Codec.Base16Data.Conduit.Codec.UuData.Conduit.Codec.XxData.Conduit.Codec.Yencb32_encode_partb32_encode_finalb32_decode_partb32_decode_finalData.Conduit.Codec.Util Paths_sandib16Encb16Decencodedecode b32EncodePartb32EncodeFinal b32DecodePartb32DecodeFinalb32hEncodePartb32hEncodeFinalb32hDecodePartb32hDecodeFinal b64EncodePartb64EncodeFinal b64DecodePartb64DecodeFinalb64uEncodePartb64uEncodeFinalb64uDecodePartb64uDecodeFinal b85EncodePartb85EncodeFinal b85DecodePartb85DecodeFinalqpEncode qpEncodeSLqpDecode uuEncodePart uuEncodeFinal uuDecodePart uuDecodeFinal xxEncodePart xxEncodeFinal xxDecodePart xxDecodeFinalyEncodeyDecodeCodecDecodeExceptionencodeIdecodeIencodeIIdecodeIIversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName