/usr/share/doc/libghc-crypto-api-doc/html/Crypto-Util.html is in libghc-crypto-api-doc 0.13.2-5.
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 | <!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>Crypto.Util</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_Crypto-Util.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Crypto-Util.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">crypto-api-0.13.2: A generic interface for cryptographic operations</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Crypto.Util</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A small selection of utilities that might be of use to others working with bytestring/number combinations.</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:incBS">incBS</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:i2bs">i2bs</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:i2bs_unsized">i2bs_unsized</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:throwLeft">throwLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Exception-Base.html#t:Exception">Exception</a> e => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> e a -> a</li><li class="src short"><a href="#v:for">for</a> :: <a href="file:///usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> a b -> a -> b</li><li class="src short"><a href="#v:.::.">(.::.)</a> :: <a href="file:///usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> a b -> a -> b</li><li class="src short"><a href="#v:constTimeEq">constTimeEq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:c_constTimeEq">c_constTimeEq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CChar">CChar</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CChar">CChar</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CInt">CInt</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CInt">CInt</a></li><li class="src short"><a href="#v:bs2i">bs2i</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:zwp-39-">zwp'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:zwp">zwp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:collect">collect</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>] -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/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:incBS" class="def">incBS</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Util.html#incBS" class="link">Source</a></p><div class="doc"><p><code>incBS bs</code> inefficiently computes the value <code>i2bs (8 * B.length bs) (bs2i bs + 1)</code></p></div></div><div class="top"><p class="src"><a name="v:i2bs" class="def">i2bs</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Util.html#i2bs" class="link">Source</a></p><div class="doc"><p><code>i2bs bitLen i</code> converts <code>i</code> to a <code>ByteString</code> of <code>bitLen</code> bits (must be a multiple of 8).</p></div></div><div class="top"><p class="src"><a name="v:i2bs_unsized" class="def">i2bs_unsized</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Util.html#i2bs_unsized" class="link">Source</a></p><div class="doc"><p><code>i2bs_unsized i</code> converts <code>i</code> to a <code>ByteString</code> of sufficient bytes to express the integer.
The integer must be non-negative and a zero will be encoded in one byte.</p></div></div><div class="top"><p class="src"><a name="v:throwLeft" class="def">throwLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Exception-Base.html#t:Exception">Exception</a> e => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> e a -> a <a href="src/Crypto-Util.html#throwLeft" class="link">Source</a></p><div class="doc"><p>Useful utility to extract the result of a generator operation
and translate error results to exceptions.</p></div></div><div class="top"><p class="src"><a name="v:for" class="def">for</a> :: <a href="file:///usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> a b -> a -> b <a href="src/Crypto-Util.html#for" class="link">Source</a></p><div class="doc"><p>Obtain a tagged value for a particular instantiated type.</p></div></div><div class="top"><p class="src"><a name="v:.::." class="def">(.::.)</a> :: <a href="file:///usr/share/doc/libghc-tagged-doc/html/Data-Tagged.html#t:Tagged">Tagged</a> a b -> a -> b <a href="src/Crypto-Util.html#.%3A%3A." class="link">Source</a></p><div class="doc"><p>Infix <code><a href="Crypto-Util.html#v:for">for</a></code> operator</p></div></div><div class="top"><p class="src"><a name="v:constTimeEq" class="def">constTimeEq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Crypto-Util.html#constTimeEq" class="link">Source</a></p><div class="doc"><p>Checks two bytestrings for equality without breaches for
timing attacks.</p><p>Semantically, <code>constTimeEq = (==)</code>. However, <code>x == y</code> takes less
time when the first byte is different than when the first byte
is equal. This side channel allows an attacker to mount a
timing attack. On the other hand, <code>constTimeEq</code> always takes the
same time regardless of the bytestrings' contents, unless they are
of difference size.</p><p>You should always use <code>constTimeEq</code> when comparing secrets,
otherwise you may leave a significant security hole
(cf. <a href="http://codahale.com/a-lesson-in-timing-attacks/">http://codahale.com/a-lesson-in-timing-attacks/</a>).</p></div></div><div class="top"><p class="src"><a name="v:c_constTimeEq" class="def">c_constTimeEq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CChar">CChar</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-Ptr.html#t:Ptr">Ptr</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CChar">CChar</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CInt">CInt</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Foreign-C-Types.html#t:CInt">CInt</a> <a href="src/Crypto-Util.html#c_constTimeEq" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:bs2i" class="def">bs2i</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html#t:Integer">Integer</a> <a href="src/Crypto-Util.html#bs2i" class="link">Source</a></p><div class="doc"><p>Helper function to convert bytestrings to integers</p></div></div><div class="top"><p class="src"><a name="v:zwp-39-" class="def">zwp'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Util.html#zwp%27" class="link">Source</a></p><div class="doc"><p>zipWith xor + Pack
As a result of rewrite rules, this should automatically be
optimized (at compile time). to use the bytestring libraries
<code>zipWith'</code> function.</p></div></div><div class="top"><p class="src"><a name="v:zwp" class="def">zwp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Crypto-Util.html#zwp" class="link">Source</a></p><div class="doc"><p>zipWith xor + Pack</p><p>This is written intentionally to take advantage
of the bytestring libraries <code>zipWith'</code> rewrite rule but at the
extra cost of the resulting lazy bytestring being more fragmented
than either of the two inputs.</p></div></div><div class="top"><p class="src"><a name="v:collect" class="def">collect</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>] -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>] <a href="src/Crypto-Util.html#collect" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|