]> Untitled Git - bitcoindevkit.org/blob
225e0763351de4e051064a92548a251b1911b261
[bitcoindevkit.org] /
1 <!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="A hashing engine which bytes can be serialized into."><title>HashEngine in bdk_chain::bitcoin::secp256k1::hashes - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="bdk_chain" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (78a775127 2024-05-11)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></a><h2><a href="../../../../bdk_chain/index.html">bdk_chain</a><span class="version">0.19.0</span></h2></div><h2 class="location"><a href="#">HashEngine</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.MidState">MidState</a></li></ul><h3><a href="#required-associated-consts">Required Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.BLOCK_SIZE">BLOCK_SIZE</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.input">input</a></li><li><a href="#tymethod.midstate">midstate</a></li><li><a href="#tymethod.n_bytes_hashed">n_bytes_hashed</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In bdk_chain::bitcoin::secp256k1::hashes</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../../../index.html">bdk_chain</a>::<wbr><a href="../../index.html">bitcoin</a>::<wbr><a href="../index.html">secp256k1</a>::<wbr><a href="index.html">hashes</a>::<wbr><a class="trait" href="#">HashEngine</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait HashEngine: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> {
2 type <a href="#associatedtype.MidState" class="associatedtype">MidState</a>;
3
4 const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;
5
6 // Required methods
7 fn <a href="#tymethod.midstate" class="fn">midstate</a>(&amp;self) -&gt; Self::<a class="associatedtype" href="trait.HashEngine.html#associatedtype.MidState" title="type bdk_chain::bitcoin::secp256k1::hashes::HashEngine::MidState">MidState</a>;
8 <span class="item-spacer"></span> fn <a href="#tymethod.input" class="fn">input</a>(&amp;mut self, data: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]);
9 <span class="item-spacer"></span> fn <a href="#tymethod.n_bytes_hashed" class="fn">n_bytes_hashed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;
10 }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A hashing engine which bytes can be serialized into.</p>
11 </div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.MidState" class="method"><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</a></h4></section></summary><div class="docblock"><p>Byte array representing the internal state of the hash engine.</p>
12 </div></details></div><h2 id="required-associated-consts" class="section-header">Required Associated Constants<a href="#required-associated-consts" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedconstant.BLOCK_SIZE" class="method"><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Length of the hash’s internal block size, in bytes.</p>
13 </div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.midstate" class="method"><h4 class="code-header">fn <a href="#tymethod.midstate" class="fn">midstate</a>(&amp;self) -&gt; Self::<a class="associatedtype" href="trait.HashEngine.html#associatedtype.MidState" title="type bdk_chain::bitcoin::secp256k1::hashes::HashEngine::MidState">MidState</a></h4></section></summary><div class="docblock"><p>Outputs the midstate of the hash engine. This function should not be
14 used directly unless you really know what you’re doing.</p>
15 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.input" class="method"><h4 class="code-header">fn <a href="#tymethod.input" class="fn">input</a>(&amp;mut self, data: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>])</h4></section></summary><div class="docblock"><p>Add data to the hash engine.</p>
16 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.n_bytes_hashed" class="method"><h4 class="code-header">fn <a href="#tymethod.n_bytes_hashed" class="fn">n_bytes_hashed</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of bytes already n_bytes_hashed(inputted).</p>
17 </div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine" class="impl"><a href="#impl-HashEngine-for-HashEngine" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::ripemd160::<a class="struct" href="../../hashes/ripemd160/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::ripemd160::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-1" class="associatedtype trait-impl"><a href="#associatedtype.MidState-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</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.array.html">20</a>]</h4></section><section id="associatedconstant.BLOCK_SIZE-1" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 64usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-1" class="impl"><a href="#impl-HashEngine-for-HashEngine-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::sha1::<a class="struct" href="../../hashes/sha1/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::sha1::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-2" class="associatedtype trait-impl"><a href="#associatedtype.MidState-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</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.array.html">20</a>]</h4></section><section id="associatedconstant.BLOCK_SIZE-2" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-2" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 64usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-2" class="impl"><a href="#impl-HashEngine-for-HashEngine-2" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::sha256::<a class="struct" href="../../hashes/sha256/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::sha256::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-3" class="associatedtype trait-impl"><a href="#associatedtype.MidState-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</a> = <a class="struct" href="../../hashes/sha256/struct.Midstate.html" title="struct bdk_chain::bitcoin::hashes::sha256::Midstate">Midstate</a></h4></section><section id="associatedconstant.BLOCK_SIZE-3" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-3" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 64usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-3" class="impl"><a href="#impl-HashEngine-for-HashEngine-3" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::sha384::<a class="struct" href="../../hashes/sha384/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::sha384::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-4" class="associatedtype trait-impl"><a href="#associatedtype.MidState-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</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.array.html">64</a>]</h4></section><section id="associatedconstant.BLOCK_SIZE-4" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-4" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 128usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-4" class="impl"><a href="#impl-HashEngine-for-HashEngine-4" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::sha512::<a class="struct" href="../../hashes/sha512/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::sha512::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-5" class="associatedtype trait-impl"><a href="#associatedtype.MidState-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</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.array.html">64</a>]</h4></section><section id="associatedconstant.BLOCK_SIZE-5" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-5" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 128usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-5" class="impl"><a href="#impl-HashEngine-for-HashEngine-5" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::sha512_256::<a class="struct" href="../../hashes/sha512_256/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::sha512_256::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-6" class="associatedtype trait-impl"><a href="#associatedtype.MidState-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</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.array.html">64</a>]</h4></section><section id="associatedconstant.BLOCK_SIZE-6" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-6" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 128usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HashEngine-6" class="impl"><a href="#impl-HashEngine-for-HashEngine-6" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for bdk_chain::bitcoin::hashes::siphash24::<a class="struct" href="../../hashes/siphash24/struct.HashEngine.html" title="struct bdk_chain::bitcoin::hashes::siphash24::HashEngine">HashEngine</a></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-7" class="associatedtype trait-impl"><a href="#associatedtype.MidState-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</a> = <a class="struct" href="../../hashes/siphash24/struct.State.html" title="struct bdk_chain::bitcoin::hashes::siphash24::State">State</a></h4></section><section id="associatedconstant.BLOCK_SIZE-7" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-7" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 8usize</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HashEngine-for-HmacEngine%3CT%3E" class="impl"><a href="#impl-HashEngine-for-HmacEngine%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.HashEngine.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::HashEngine">HashEngine</a> for <a class="struct" href="struct.HmacEngine.html" title="struct bdk_chain::bitcoin::secp256k1::hashes::HmacEngine">HmacEngine</a>&lt;T&gt;<div class="where">where
18 T: <a class="trait" href="trait.Hash.html" title="trait bdk_chain::bitcoin::secp256k1::hashes::Hash">Hash</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.MidState-8" class="associatedtype trait-impl"><a href="#associatedtype.MidState-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.MidState" class="associatedtype">MidState</a> = <a class="struct" href="../../hashes/hmac/struct.HmacMidState.html" title="struct bdk_chain::bitcoin::hashes::hmac::HmacMidState">HmacMidState</a>&lt;T&gt;</h4></section><section id="associatedconstant.BLOCK_SIZE-8" class="associatedconstant trait-impl"><a href="#associatedconstant.BLOCK_SIZE-8" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.BLOCK_SIZE" class="constant">BLOCK_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = &lt;T::Engine&gt;::BLOCK_SIZE</h4></section></div></details></div><script src="../../../../trait.impl/bitcoin_hashes/trait.HashEngine.js" data-ignore-extern-crates="bitcoin_hashes" async></script></section></div></main></body></html>