/usr/share/doc/libghc-raaz-doc/html/Raaz-Hash.html is in libghc-raaz-doc 0.0.2-3.
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 | <!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>Raaz.Hash</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Raaz-Hash.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Raaz-Hash.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">raaz-0.0.2: The raaz cryptographic library.</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">Raaz.Hash</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Cryptographic hashes and hmacs.</a><ul><li><a href="#g:2">Encoding and displaying.</a></li></ul></li><li><a href="#g:3">Exposing individual hashes.</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module exposes all the cryptographic hash functions available
under the raaz library.</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"><span class="keyword">class</span> (<a href="Raaz-Core-Primitives.html#t:Primitive">Primitive</a> h, <a href="Raaz-Core-Types.html#t:EndianStore">EndianStore</a> h, <a href="Raaz-Core-Encode.html#t:Encodable">Encodable</a> h, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> h, <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> h ~ <a href="Raaz-Hash-Internal.html#t:SomeHashI">SomeHashI</a> h) => <a href="#t:Hash">Hash</a> h</li><li class="src short"><a href="#v:hash">hash</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:PureByteSource">PureByteSource</a> src) => src -> h</li><li class="src short"><a href="#v:hashFile">hashFile</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> h</li><li class="src short"><a href="#v:hashSource">hashSource</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:ByteSource">ByteSource</a> src) => src -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> h</li><li class="src short"><span class="keyword">data</span> <a href="#t:HMAC">HMAC</a> h</li><li class="src short"><a href="#v:hmac">hmac</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:PureByteSource">PureByteSource</a> src) => <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> src -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h</li><li class="src short"><a href="#v:hmacFile">hmacFile</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h) => <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</li><li class="src short"><a href="#v:hmacSource">hmacSource</a> :: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:ByteSource">ByteSource</a> src) => <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> src -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</li><li class="src short">module <a href="Raaz-Hash-Sha1.html">Raaz.Hash.Sha1</a></li><li class="src short">module <a href="Raaz-Hash-Sha224.html">Raaz.Hash.Sha224</a></li><li class="src short">module <a href="Raaz-Hash-Sha256.html">Raaz.Hash.Sha256</a></li><li class="src short">module <a href="Raaz-Hash-Sha384.html">Raaz.Hash.Sha384</a></li><li class="src short">module <a href="Raaz-Hash-Sha512.html">Raaz.Hash.Sha512</a></li></ul></div><div id="interface"><h1 id="g:1">Cryptographic hashes and hmacs.</h1><div class="doc"><p>The cryptographic hashes provided by raaz give the following
guarantees:</p><ol><li>Distinct hashes are distinct types and hence it is a compiler
error to compare two different hashes.</li><li>A hash and its associated hmac are distinct types and hence
it is an compile time error to compare a hash with its hmac.</li><li>The <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a></code> instance for hashes and the corresponding hmacs use
a constant time equality test and hence it is safe to check
equality using the operator <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#v:-61--61-">==</a></code>.</li></ol><p>The functions <code><a href="Raaz-Hash.html#v:hash">hash</a></code>, <code><a href="Raaz-Hash.html#v:hashFile">hashFile</a></code>, and <code><a href="Raaz-Hash.html#v:hashSource">hashSource</a></code> provide a rather
high level interface for computing hashes. For hmacs the associated
functions are <code><a href="Raaz-Hash.html#v:hmac">hmac</a></code>, <code><a href="Raaz-Hash.html#v:hmacFile">hmacFile</a></code>, and <code><a href="Raaz-Hash.html#v:hmacSource">hmacSource</a></code></p></div><h2 id="g:2">Encoding and displaying.</h2><div class="doc"><p>When interfacing with other applications or when printing output to
users, it is often necessary to encode hash, hmac or their keys as
strings. Applications usually present hashes encoded in base16. The
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#v:IsString">IsString</a></code> instances for the hashes exposed
here follow this convention.</p><p>More generaly, hashes, hmacs and their key are instances of type
class <code><a href="Raaz-Core-Encode.html#v:Encodable">Encodable</a></code> and can hence can be encoded in
any of the formats supported in raaz.</p></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Raaz-Core-Primitives.html#t:Primitive">Primitive</a> h, <a href="Raaz-Core-Types.html#t:EndianStore">EndianStore</a> h, <a href="Raaz-Core-Encode.html#t:Encodable">Encodable</a> h, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> h, <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> h ~ <a href="Raaz-Hash-Internal.html#t:SomeHashI">SomeHashI</a> h) => <a id="t:Hash" class="def">Hash</a> h <a href="src/Raaz-Hash-Internal.html#Hash" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></p><div class="doc"><p>Type class capturing a cryptographic hash.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Raaz-Hash-Internal.html#v:additionalPadBlocks">additionalPadBlocks</a></p></div><div class="subs instances"><p id="control.i:Hash" class="caption collapser" onclick="toggleSection('i:Hash')">Instances</p><div id="section.i:Hash" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Hash:Hash:1" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:1')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> <a href="Raaz-Hash-Sha1.html#t:SHA1">SHA1</a></span> <a href="src/Raaz-Hash-Internal.html#line-59" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Hash:Hash:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:additionalPadBlocks">additionalPadBlocks</a> :: <a href="Raaz-Hash-Sha1.html#t:SHA1">SHA1</a> -> <a href="Raaz-Core-Primitives.html#t:BLOCKS">BLOCKS</a> <a href="Raaz-Hash-Sha1.html#t:SHA1">SHA1</a> <a href="src/Raaz-Hash-Internal.html#additionalPadBlocks" class="link">Source</a> <a href="#v:additionalPadBlocks" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Hash:Hash:2" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:2')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> <a href="Raaz-Hash-Sha224.html#t:SHA224">SHA224</a></span> <a href="src/Raaz-Hash-Internal.html#line-49" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Hash:Hash:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:additionalPadBlocks">additionalPadBlocks</a> :: <a href="Raaz-Hash-Sha224.html#t:SHA224">SHA224</a> -> <a href="Raaz-Core-Primitives.html#t:BLOCKS">BLOCKS</a> <a href="Raaz-Hash-Sha224.html#t:SHA224">SHA224</a> <a href="src/Raaz-Hash-Internal.html#additionalPadBlocks" class="link">Source</a> <a href="#v:additionalPadBlocks" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Hash:Hash:3" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:3')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> <a href="Raaz-Hash-Sha256.html#t:SHA256">SHA256</a></span> <a href="src/Raaz-Hash-Internal.html#line-52" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Hash:Hash:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:additionalPadBlocks">additionalPadBlocks</a> :: <a href="Raaz-Hash-Sha256.html#t:SHA256">SHA256</a> -> <a href="Raaz-Core-Primitives.html#t:BLOCKS">BLOCKS</a> <a href="Raaz-Hash-Sha256.html#t:SHA256">SHA256</a> <a href="src/Raaz-Hash-Internal.html#additionalPadBlocks" class="link">Source</a> <a href="#v:additionalPadBlocks" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Hash:Hash:4" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:4')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> <a href="Raaz-Hash-Sha384.html#t:SHA384">SHA384</a></span> <a href="src/Raaz-Hash-Internal.html#line-38" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Hash:Hash:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:additionalPadBlocks">additionalPadBlocks</a> :: <a href="Raaz-Hash-Sha384.html#t:SHA384">SHA384</a> -> <a href="Raaz-Core-Primitives.html#t:BLOCKS">BLOCKS</a> <a href="Raaz-Hash-Sha384.html#t:SHA384">SHA384</a> <a href="src/Raaz-Hash-Internal.html#additionalPadBlocks" class="link">Source</a> <a href="#v:additionalPadBlocks" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:Hash:Hash:5" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:5')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> <a href="Raaz-Hash-Sha512.html#t:SHA512">SHA512</a></span> <a href="src/Raaz-Hash-Internal.html#line-52" class="link">Source</a> <a href="#t:Hash" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:ic:Hash:Hash:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:additionalPadBlocks">additionalPadBlocks</a> :: <a href="Raaz-Hash-Sha512.html#t:SHA512">SHA512</a> -> <a href="Raaz-Core-Primitives.html#t:BLOCKS">BLOCKS</a> <a href="Raaz-Hash-Sha512.html#t:SHA512">SHA512</a> <a href="src/Raaz-Hash-Internal.html#additionalPadBlocks" class="link">Source</a> <a href="#v:additionalPadBlocks" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:hash" class="def">hash</a> <a href="src/Raaz-Hash-Internal.html#hash" class="link">Source</a> <a href="#v:hash" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:PureByteSource">PureByteSource</a> src)</td><td class="doc empty"> </td></tr><tr><td class="src">=> src</td><td class="doc"><p>Message</p></td></tr><tr><td class="src">-> h</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of a pure byte source like, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:hashFile" class="def">hashFile</a> <a href="src/Raaz-Hash-Internal.html#hashFile" class="link">Source</a> <a href="#v:hashFile" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>File to be hashed</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> h</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of file.</p></div></div><div class="top"><p class="src"><a id="v:hashSource" class="def">hashSource</a> <a href="src/Raaz-Hash-Internal.html#hashSource" class="link">Source</a> <a href="#v:hashSource" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:ByteSource">ByteSource</a> src)</td><td class="doc empty"> </td></tr><tr><td class="src">=> src</td><td class="doc"><p>Message</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> h</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of a generic byte source.</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:HMAC" class="def">HMAC</a> h <a href="src/Raaz-Hash-Internal-HMAC.html#HMAC" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></p><div class="doc"><p>The HMAC associated to a hash value. The HMAC type is essentially
the underlying hash type wrapped inside a newtype. Therefore, the
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a></code> instance for HMAC is essentially the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a></code> instance for the
underlying hash. It is safe against timing attack provided the
underlying hash comparison is safe under timing attack.</p></div><div class="subs instances"><p id="control.i:HMAC" class="caption collapser" onclick="toggleSection('i:HMAC')">Instances</p><div id="section.i:HMAC" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Eq:1" class="instance expander" onclick="toggleSection('i:id:HMAC:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> h => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-107" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Show:2" class="instance expander" onclick="toggleSection('i:id:HMAC:Show:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> h => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-112" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Show:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:IsString:3" class="instance expander" onclick="toggleSection('i:id:HMAC:IsString:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:IsString">IsString</a> h => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:IsString">IsString</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-110" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:IsString:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromString">fromString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h <a href="#v:fromString" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Storable:4" class="instance expander" onclick="toggleSection('i:id:HMAC:Storable:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Storable.html#t:Storable">Storable</a> h => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Storable.html#t:Storable">Storable</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-107" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Storable:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:sizeOf">sizeOf</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> <a href="#v:sizeOf" class="selflink">#</a></p><p class="src"><a href="#v:alignment">alignment</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> <a href="#v:alignment" class="selflink">#</a></p><p class="src"><a href="#v:peekElemOff">peekElemOff</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="#v:peekElemOff" class="selflink">#</a></p><p class="src"><a href="#v:pokeElemOff">pokeElemOff</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> () <a href="#v:pokeElemOff" class="selflink">#</a></p><p class="src"><a href="#v:peekByteOff">peekByteOff</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> b -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="#v:peekByteOff" class="selflink">#</a></p><p class="src"><a href="#v:pokeByteOff">pokeByteOff</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> b -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> () <a href="#v:pokeByteOff" class="selflink">#</a></p><p class="src"><a href="#v:peek">peek</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="#v:peek" class="selflink">#</a></p><p class="src"><a href="#v:poke">poke</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Foreign-Ptr.html#t:Ptr">Ptr</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> () <a href="#v:poke" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:EndianStore:5" class="instance expander" onclick="toggleSection('i:id:HMAC:EndianStore:5')"></span> <a href="Raaz-Core-Types.html#t:EndianStore">EndianStore</a> h => <a href="Raaz-Core-Types.html#t:EndianStore">EndianStore</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-108" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:EndianStore:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:store">store</a> :: <a href="Raaz-Core-Types.html#t:Pointer">Pointer</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> () <a href="src/Raaz-Core-Types-Endian.html#store" class="link">Source</a> <a href="#v:store" class="selflink">#</a></p><p class="src"><a href="#v:load">load</a> :: <a href="Raaz-Core-Types.html#t:Pointer">Pointer</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="src/Raaz-Core-Types-Endian.html#load" class="link">Source</a> <a href="#v:load" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Encodable:6" class="instance expander" onclick="toggleSection('i:id:HMAC:Encodable:6')"></span> <a href="Raaz-Core-Encode.html#t:Encodable">Encodable</a> h => <a href="Raaz-Core-Encode.html#t:Encodable">Encodable</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-109" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Encodable:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toByteString">toByteString</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Raaz-Core-Encode-Internal.html#toByteString" class="link">Source</a> <a href="#v:toByteString" class="selflink">#</a></p><p class="src"><a href="#v:fromByteString">fromByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="src/Raaz-Core-Encode-Internal.html#fromByteString" class="link">Source</a> <a href="#v:fromByteString" class="selflink">#</a></p><p class="src"><a href="#v:unsafeFromByteString">unsafeFromByteString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a> -> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h <a href="src/Raaz-Core-Encode-Internal.html#unsafeFromByteString" class="link">Source</a> <a href="#v:unsafeFromByteString" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Symmetric:7" class="instance expander" onclick="toggleSection('i:id:HMAC:Symmetric:7')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> h => <a href="Raaz-Core-Primitives.html#t:Symmetric">Symmetric</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-125" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Symmetric:7" class="inst-details hide"><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> <a href="src/Raaz-Core-Primitives.html#Key" class="link">Source</a> <a href="#t:Key" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Recommendation:8" class="instance expander" onclick="toggleSection('i:id:HMAC:Recommendation:8')"></span> (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h) => <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-121" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Recommendation:8" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:recommended">recommended</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) <a href="src/Raaz-Core-Primitives.html#recommended" class="link">Source</a> <a href="#v:recommended" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Primitive:9" class="instance expander" onclick="toggleSection('i:id:HMAC:Primitive:9')"></span> <a href="Raaz-Hash.html#t:Hash">Hash</a> h => <a href="Raaz-Core-Primitives.html#t:Primitive">Primitive</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-115" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Primitive:9" class="inst-details hide"><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> <a href="src/Raaz-Core-Primitives.html#Implementation" class="link">Source</a> <a href="#t:Implementation" class="selflink">#</a></p></div> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:blockSize">blockSize</a> :: <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h -> <a href="Raaz-Core-Types.html#t:BYTES">BYTES</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> <a href="src/Raaz-Core-Primitives.html#blockSize" class="link">Source</a> <a href="#v:blockSize" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Key:10" class="instance expander" onclick="toggleSection('i:id:HMAC:Key:10')"></span> <span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-126" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Key:10" class="inst-details hide"><div class="src"><span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:HMAC:Implementation:11" class="instance expander" onclick="toggleSection('i:id:HMAC:Implementation:11')"></span> <span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</span> <a href="src/Raaz-Hash-Internal-HMAC.html#line-119" class="link">Source</a> <a href="#t:HMAC" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:HMAC:Implementation:11" class="inst-details hide"><div class="src"><span class="keyword">type</span> <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h) = <a href="Raaz-Core-Primitives.html#t:Implementation">Implementation</a> h</div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:hmac" class="def">hmac</a> <a href="src/Raaz-Hash-Internal-HMAC.html#hmac" class="link">Source</a> <a href="#v:hmac" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:PureByteSource">PureByteSource</a> src)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</td><td class="doc empty"> </td></tr><tr><td class="src">-> src</td><td class="doc"><p>Message</p></td></tr><tr><td class="src">-> <a href="Raaz-Hash.html#t:HMAC">HMAC</a> h</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of a pure byte source like, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#t:ByteString">ByteString</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:hmacFile" class="def">hmacFile</a> <a href="src/Raaz-Hash-Internal-HMAC.html#hmacFile" class="link">Source</a> <a href="#v:hmacFile" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>File to be hashed</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of file.</p></div></div><div class="top"><p class="src"><a id="v:hmacSource" class="def">hmacSource</a> <a href="src/Raaz-Hash-Internal-HMAC.html#hmacSource" class="link">Source</a> <a href="#v:hmacSource" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Raaz-Hash.html#t:Hash">Hash</a> h, <a href="Raaz-Core-Primitives.html#t:Recommendation">Recommendation</a> h, <a href="Raaz-Core-ByteSource.html#t:ByteSource">ByteSource</a> src)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Raaz-Core-Primitives.html#t:Key">Key</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</td><td class="doc empty"> </td></tr><tr><td class="src">-> src</td><td class="doc"><p>Message</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/System-IO.html#t:IO">IO</a> (<a href="Raaz-Hash.html#t:HMAC">HMAC</a> h)</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the hash of a generic byte source.</p></div></div><h1 id="g:3">Exposing individual hashes.</h1><div class="doc"><p>Individual hash and hmacs are exposed via their respective modules.
These module also export the specialized variants for <code><a href="Raaz-Hash.html#v:hashSource">hashSource</a></code>,
<code><a href="Raaz-Hash.html#v:hash">hash</a></code> and <code><a href="Raaz-Hash.html#v:hashFile">hashFile</a></code> for specific hashes. For example, if you are
interested only in say <code><a href="Raaz-Hash-Sha512.html#t:SHA512">SHA512</a></code> you can import the module
<a href="Raaz-Hash-Sha512.html">Raaz.Hash.Sha512</a>. This will expose the functions <code><a href="Raaz-Hash-Sha512.html#v:sha512Source">sha512Source</a></code>,
<code><a href="Raaz-Hash-Sha512.html#v:sha512">sha512</a></code> and <code><a href="Raaz-Hash-Sha512.html#v:sha512File">sha512File</a></code> which are specialized variants of
<code><a href="Raaz-Hash.html#v:hashSource">hashSource</a></code> <code><a href="Raaz-Hash.html#v:hash">hash</a></code> and <code><a href="Raaz-Hash.html#v:hashFile">hashFile</a></code> respectively for the hash
<code><a href="Raaz-Hash-Sha512.html#t:SHA512">SHA512</a></code>. For example, if you want to print the sha512 checksum of
a file, you can use the following.</p><pre>sha512Checksum :: FilePath -> IO ()
-- print the sha512 checksum of a given file.
sha512Checksum fname = sha512File fname >>= print</pre></div><div class="top"><p class="src">module <a href="Raaz-Hash-Sha1.html">Raaz.Hash.Sha1</a></p></div><div class="top"><p class="src">module <a href="Raaz-Hash-Sha224.html">Raaz.Hash.Sha224</a></p></div><div class="top"><p class="src">module <a href="Raaz-Hash-Sha256.html">Raaz.Hash.Sha256</a></p></div><div class="top"><p class="src">module <a href="Raaz-Hash-Sha384.html">Raaz.Hash.Sha384</a></p></div><div class="top"><p class="src">module <a href="Raaz-Hash-Sha512.html">Raaz.Hash.Sha512</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>
|