<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `hash` fn in crate `md6`."><meta name="keywords" content="rust, rustlang, rust-lang, hash"><title>md6::hash - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css"  id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../md6/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>md6</a></p><script>window.sidebarCurrent = {name: 'hash', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><span class="help-button">?</span>
                <a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/md6/lib.rs.html#119-124' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>md6</a>::<wbr><a class="fn" href=''>hash</a></span></h1><pre class='rust fn'>pub fn hash(hashbitlen: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, hashval: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="../md6/type.Result.html" title="type md6::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</pre><div class='docblock'><p>Hash all data in one fell swoop.</p>
<p>Refer to individual functions for extended documentation.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">result_256</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">32</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">result_512</span> <span class="op">=</span> [<span class="number">0</span>; <span class="number">64</span>];

<span class="ident">md6</span>::<span class="ident">hash</span>(<span class="number">256</span>, <span class="kw-2">&amp;</span>[], <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">result_256</span>).<span class="ident">unwrap</span>();
<span class="ident">md6</span>::<span class="ident">hash</span>(<span class="number">512</span>, <span class="kw-2">&amp;</span>[], <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">result_512</span>).<span class="ident">unwrap</span>();

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Vec</span>::<span class="ident">from_iter</span>(<span class="ident">result_256</span>.<span class="ident">iter</span>().<span class="ident">map</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">i</span><span class="op">|</span> <span class="ident">i</span>)),
           <span class="macro">vec</span><span class="macro">!</span>[<span class="number">0xBC</span>, <span class="number">0xA3</span>, <span class="number">0x8B</span>, <span class="number">0x24</span>, <span class="number">0xA8</span>, <span class="number">0x04</span>, <span class="number">0xAA</span>, <span class="number">0x37</span>,
                <span class="number">0xD8</span>, <span class="number">0x21</span>, <span class="number">0xD3</span>, <span class="number">0x1A</span>, <span class="number">0xF0</span>, <span class="number">0x0F</span>, <span class="number">0x55</span>, <span class="number">0x98</span>,
                <span class="number">0x23</span>, <span class="number">0x01</span>, <span class="number">0x22</span>, <span class="number">0xC5</span>, <span class="number">0xBB</span>, <span class="number">0xFC</span>, <span class="number">0x4C</span>, <span class="number">0x4A</span>,
                <span class="number">0xD5</span>, <span class="number">0xED</span>, <span class="number">0x40</span>, <span class="number">0xE4</span>, <span class="number">0x25</span>, <span class="number">0x8F</span>, <span class="number">0x04</span>, <span class="number">0xCA</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Vec</span>::<span class="ident">from_iter</span>(<span class="ident">result_512</span>.<span class="ident">iter</span>().<span class="ident">map</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">i</span><span class="op">|</span> <span class="ident">i</span>)),
           <span class="macro">vec</span><span class="macro">!</span>[<span class="number">0x6B</span>, <span class="number">0x7F</span>, <span class="number">0x33</span>, <span class="number">0x82</span>, <span class="number">0x1A</span>, <span class="number">0x2C</span>, <span class="number">0x06</span>, <span class="number">0x0E</span>,
                <span class="number">0xCD</span>, <span class="number">0xD8</span>, <span class="number">0x1A</span>, <span class="number">0xEF</span>, <span class="number">0xDD</span>, <span class="number">0xEA</span>, <span class="number">0x2F</span>, <span class="number">0xD3</span>,
                <span class="number">0xC4</span>, <span class="number">0x72</span>, <span class="number">0x02</span>, <span class="number">0x70</span>, <span class="number">0xE1</span>, <span class="number">0x86</span>, <span class="number">0x54</span>, <span class="number">0xF4</span>,
                <span class="number">0xCB</span>, <span class="number">0x08</span>, <span class="number">0xEC</span>, <span class="number">0xE4</span>, <span class="number">0x9C</span>, <span class="number">0xCB</span>, <span class="number">0x46</span>, <span class="number">0x9F</span>,
                <span class="number">0x8B</span>, <span class="number">0xEE</span>, <span class="number">0xEE</span>, <span class="number">0x7C</span>, <span class="number">0x83</span>, <span class="number">0x12</span>, <span class="number">0x06</span>, <span class="number">0xBD</span>,
                <span class="number">0x57</span>, <span class="number">0x7F</span>, <span class="number">0x9F</span>, <span class="number">0x26</span>, <span class="number">0x30</span>, <span class="number">0xD9</span>, <span class="number">0x17</span>, <span class="number">0x79</span>,
                <span class="number">0x79</span>, <span class="number">0x20</span>, <span class="number">0x3A</span>, <span class="number">0x94</span>, <span class="number">0x89</span>, <span class="number">0xE4</span>, <span class="number">0x7E</span>, <span class="number">0x04</span>,
                <span class="number">0xDF</span>, <span class="number">0x4E</span>, <span class="number">0x6D</span>, <span class="number">0xEA</span>, <span class="number">0xA0</span>, <span class="number">0xF8</span>, <span class="number">0xE0</span>, <span class="number">0xC0</span>]);</pre></div>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "md6";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>