mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
57 lines
11 KiB
HTML
57 lines
11 KiB
HTML
|
<!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 `blake2b_simd` crate."><meta name="keywords" content="rust, rustlang, rust-lang, blake2b_simd"><title>blake2b_simd - 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="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[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">☰</div><a href='../blake2b_simd/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate blake2b_simd</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all blake2b_simd's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'blake2b_simd', ty: 'mod', relpath: '../'};</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 js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><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'>−</span>]</a></span><a class='srclink' href='../src/blake2b_simd/lib.rs.html#1-675' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>blake2b_simd</a></span></h1><div class='docblock'><p><a href="https://github.com/oconnor663/blake2_simd"><img src="https://img.shields.io/github/tag/oconnor663/blake2_simd.svg?label=GitHub" alt="GitHub" /></a> <a href="https://crates.io/crates/blake2b_simd"><img src="https://img.shields.io/crates/v/blake2b_simd.svg" alt="crates.io" /></a> <a href="https://travis-ci.org/oconnor663/blake2_simd"><img src="https://travis-ci.org/oconnor663/blake2_simd.svg?branch=master" alt="Build Status" /></a></p>
|
|||
|
<p>An implementation of the BLAKE2b and BLAKE2bp hash functions. See also
|
|||
|
<a href="https://docs.rs/blake2s_simd"><code>blake2s_simd</code></a>.</p>
|
|||
|
<p>This crate includes:</p>
|
|||
|
<ul>
|
|||
|
<li>100% stable Rust.</li>
|
|||
|
<li>SIMD implementations based on Samuel Neves' <a href="https://github.com/sneves/blake2-avx2"><code>blake2-avx2</code></a>.
|
|||
|
These are very fast. For benchmarks, see <a href="https://github.com/oconnor663/blake2_simd#performance">the Performance section of the
|
|||
|
README</a>.</li>
|
|||
|
<li>Portable, safe implementations for other platforms.</li>
|
|||
|
<li>Dynamic CPU feature detection. Binaries include multiple implementations by default and
|
|||
|
choose the fastest one the processor supports at runtime.</li>
|
|||
|
<li>All the features from the <a href="https://blake2.net/blake2.pdf">the BLAKE2 spec</a>, like adjustable
|
|||
|
length, keying, and associated data for tree hashing.</li>
|
|||
|
<li><code>no_std</code> support. The <code>std</code> Cargo feature is on by default, for CPU feature detection and
|
|||
|
for implementing <code>std::io::Write</code>.</li>
|
|||
|
<li>Support for computing multiple BLAKE2b hashes in parallel, matching the efficiency of
|
|||
|
BLAKE2bp. See the <a href="many/index.html"><code>many</code></a> module.</li>
|
|||
|
</ul>
|
|||
|
<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">use</span> <span class="ident">blake2b_simd</span>::{<span class="ident">blake2b</span>, <span class="ident">Params</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">expected</span> <span class="op">=</span> <span class="string">"ca002330e69d3e6b84a46a56a6533fd79d51d97a3bb7cad6c2ff43b354185d6d\
|
|||
|
c1e723fb3db4ae0737e120378424c714bb982d9dc5bbd7a0ab318240ddd18f8d"</span>;
|
|||
|
<span class="kw">let</span> <span class="ident">hash</span> <span class="op">=</span> <span class="ident">blake2b</span>(<span class="string">b"foo"</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">expected</span>, <span class="kw-2">&</span><span class="ident">hash</span>.<span class="ident">to_hex</span>());
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">hash</span> <span class="op">=</span> <span class="ident">Params</span>::<span class="ident">new</span>()
|
|||
|
.<span class="ident">hash_length</span>(<span class="number">16</span>)
|
|||
|
.<span class="ident">key</span>(<span class="string">b"The Magic Words are Squeamish Ossifrage"</span>)
|
|||
|
.<span class="ident">personal</span>(<span class="string">b"L. P. Waterhouse"</span>)
|
|||
|
.<span class="ident">to_state</span>()
|
|||
|
.<span class="ident">update</span>(<span class="string">b"foo"</span>)
|
|||
|
.<span class="ident">update</span>(<span class="string">b"bar"</span>)
|
|||
|
.<span class="ident">update</span>(<span class="string">b"baz"</span>)
|
|||
|
.<span class="ident">finalize</span>();
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">"ee8ff4e9be887297cf79348dc35dab56"</span>, <span class="kw-2">&</span><span class="ident">hash</span>.<span class="ident">to_hex</span>());</pre></div>
|
|||
|
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="mod" href="blake2bp/index.html" title='blake2b_simd::blake2bp mod'>blake2bp</a></td><td class='docblock-short'><p>BLAKE2bp, a variant of BLAKE2b that uses SIMD more efficiently.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="mod" href="many/index.html" title='blake2b_simd::many mod'>many</a></td><td class='docblock-short'><p>Interfaces for hashing multiple inputs at once, using SIMD more
|
|||
|
efficiently.</p>
|
|||
|
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="struct" href="struct.Hash.html" title='blake2b_simd::Hash struct'>Hash</a></td><td class='docblock-short'><p>A finalized BLAKE2 hash, with constant-time equality.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Params.html" title='blake2b_simd::Params struct'>Params</a></td><td class='docblock-short'><p>A parameter builder that exposes all the non-default BLAKE2 features.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.State.html" title='blake2b_simd::State struct'>State</a></td><td class='docblock-short'><p>An incremental hasher for BLAKE2b.</p>
|
|||
|
</td></tr></table><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="constant" href="constant.BLOCKBYTES.html" title='blake2b_simd::BLOCKBYTES constant'>BLOCKBYTES</a></td><td class='docblock-short'><p>The number input bytes passed to each call to the compression function. Small benchmarks need
|
|||
|
to use an even multiple of <code>BLOCKBYTES</code>, or else their apparent throughput will be low.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="constant" href="constant.KEYBYTES.html" title='blake2b_simd::KEYBYTES constant'>KEYBYTES</a></td><td class='docblock-short'><p>The max key length.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="constant" href="constant.OUTBYTES.html" title='blake2b_simd::OUTBYTES constant'>OUTBYTES</a></td><td class='docblock-short'><p>The max hash length.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="constant" href="constant.PERSONALBYTES.html" title='blake2b_simd::PERSONALBYTES constant'>PERSONALBYTES</a></td><td class='docblock-short'><p>The max personalization length.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="constant" href="constant.SALTBYTES.html" title='blake2b_simd::SALTBYTES constant'>SALTBYTES</a></td><td class='docblock-short'><p>The max salt length.</p>
|
|||
|
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="fn" href="fn.blake2b.html" title='blake2b_simd::blake2b fn'>blake2b</a></td><td class='docblock-short'><p>Compute the BLAKE2b hash of a slice of bytes all at once, using default
|
|||
|
parameters.</p>
|
|||
|
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "blake2b_simd";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|