/usr/share/doc/libghc-sandi-doc/html/Codec-Binary-Base64.html is in libghc-sandi-doc 0.3.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Codec.Binary.Base64</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Codec-Binary-Base64.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Codec-Binary-Base64.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">sandi-0.3.0.1: Data encoding library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Codec.Binary.Base64</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Implemented as specified in RFC 4648 (<a href="http://tools.ietf.org/html/rfc4648">http://tools.ietf.org/html/rfc4648</a>).
</p><p>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.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:b64_encode_part">b64_encode_part</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:b64_encode_final">b64_encode_final</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:b64_decode_part">b64_decode_part</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>) (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:b64_decode_final">b64_decode_final</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:encode">encode</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:decode">decode</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:b64_encode_part" class="def">b64_encode_part</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>)<a href="src/Codec-Binary-Base64.html#b64_encode_part" class="link">Source</a></p><div class="doc"><p>Encoding function.
</p><p>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 <code><a href="Codec-Binary-Base64.html#v:b64_encode_final">b64_encode_final</a></code> as is.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_encode_part $ Data.ByteString.Char8.pack "foo"
</code></strong>("Zm9v","")
<code class="prompt">>>> </code><strong class="userinput"><code>b64_encode_part $ Data.ByteString.Char8.pack "foob"
</code></strong>("Zm9v","b")
</pre></div></div><div class="top"><p class="src"><a name="v:b64_encode_final" class="def">b64_encode_final</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Codec-Binary-Base64.html#b64_encode_final" class="link">Source</a></p><div class="doc"><p>Encoding function for the final block.
</p><p>The final block has to have a size less than 3.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_encode_final $ Data.ByteString.Char8.pack "r"
</code></strong>Just "cg=="
</pre><p>Trying to pass in too large a block result in failure:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_encode_final $ Data.ByteString.Char8.pack "foo"
</code></strong>Nothing
</pre></div></div><div class="top"><p class="src"><a name="v:b64_decode_part" class="def">b64_decode_part</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>) (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>)<a href="src/Codec-Binary-Base64.html#b64_decode_part" class="link">Source</a></p><div class="doc"><p>Decoding function.
</p><p>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 <code>Right</code> value:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_part $ Data.ByteString.Char8.pack "Zm9v"
</code></strong>Right ("foo","")
<code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_part $ Data.ByteString.Char8.pack "Zm9vYmE="
</code></strong>Right ("foo","YmE=")
</pre><p>Failures occur on bad input and result in a <code>Left</code> value:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_part $ Data.ByteString.Char8.pack "Z=9v"
</code></strong>Left ("","Z=9v")
</pre></div></div><div class="top"><p class="src"><a name="v:b64_decode_final" class="def">b64_decode_final</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Codec-Binary-Base64.html#b64_decode_final" class="link">Source</a></p><div class="doc"><p>Decoding function for the final block.
</p><p>The final block has to have a size of 0 or 4:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_final $ Data.ByteString.Char8.pack "Zm8="
</code></strong>Just "fo"
<code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_final $ Data.ByteString.Char8.pack ""
</code></strong>Just ""
<code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_final $ Data.ByteString.Char8.pack "Zm="
</code></strong>Nothing
</pre><p>But it must be the encoding of a block that is less than 3 bytes:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>b64_decode_final $ encode $ Data.ByteString.Char8.pack "foo"
</code></strong>Nothing
</pre></div></div><div class="top"><p class="src"><a name="v:encode" class="def">encode</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Codec-Binary-Base64.html#encode" class="link">Source</a></p><div class="doc"><p>Convenience function that combines <code><a href="Codec-Binary-Base64.html#v:b64_encode_part">b64_encode_part</a></code> and
<code><a href="Codec-Binary-Base64.html#v:b64_encode_final">b64_encode_final</a></code> to encode a complete string.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>encode $ Data.ByteString.Char8.pack "foo"
</code></strong>"Zm9v"
<code class="prompt">>>> </code><strong class="userinput"><code>encode $ Data.ByteString.Char8.pack "foobar"
</code></strong>"Zm9vYmFy"
</pre></div></div><div class="top"><p class="src"><a name="v:decode" class="def">decode</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Either.html#t:Either">Either</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a>) <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.0.2/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Codec-Binary-Base64.html#decode" class="link">Source</a></p><div class="doc"><p>Convenience function that combines <code><a href="Codec-Binary-Base64.html#v:b64_decode_part">b64_decode_part</a></code> and
<code><a href="Codec-Binary-Base64.html#v:b64_decode_final">b64_decode_final</a></code> to decode a complete string.
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>decode $ Data.ByteString.Char8.pack "Zm9v"
</code></strong>Right "foo"
<code class="prompt">>>> </code><strong class="userinput"><code>decode $ Data.ByteString.Char8.pack "Zm9vYmFy"
</code></strong>Right "foobar"
</pre><p>Failures when decoding returns the decoded part and the remainder:
</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>decode $ Data.ByteString.Char8.pack "Zm9vYm=y"
</code></strong>Left ("foo","Ym=y")
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|