<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="The set of circuit instructions required to use the [`Sha256`] gadget."><metaname="keywords"content="rust, rustlang, rust-lang, Sha256Instructions"><title>Sha256Instructions in halo2_gadgets::sha256 - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-cd23e1e4557aa9dd.css"id="mainThemeStyle"><linkrel="stylesheet"id="themeStyle"href="../../static.files/light-a21928845c7a186a.css"><linkrel="stylesheet"disabledhref="../../static.files/dark-90fc67ff25a42f29.css"><linkrel="stylesheet"disabledhref="../../static.files/ayu-d75a8bbde915b8ed.css"><scriptid="default-settings"></script><scriptsrc="../../static.files/storage-d43fa987303ecbbb.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-458bffc4c06ccf37.js"></script><noscript><linkrel="stylesheet"href="../../static.files/noscript-13285aec31fa243e.css"></noscript><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../static.files/favicon-2c020d218678b618.svg"><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css"integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y"crossorigin="anonymous">
</head><bodyclass="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="sidebar-logo"href="../../halo2_gadgets/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></div></a><h2></h2></nav><navclass="sidebar"><aclass="sidebar-logo"href="../../halo2_gadgets/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></div></a><h2class="location"><ahref="#">Sha256Instructions</a></h2><divclass="sidebar-elems"><section><h3><ahref="#required-associated-types">Required Associated Types</a></h3><ulclass="block"><li><ahref="#associatedtype.BlockWord">BlockWord</a></li><li><ahref="#associatedtype.State">State</a></li></ul><h3><ahref="#required-methods">Required Methods</a></h3><ulclass="block"><li><ahref="#tymethod.compress">compress</a></li><li><ahref="#tymethod.digest">digest</a></li><li><ahref="#tymethod.initialization">initialization</a></li><li><ahref="#tymethod.initialization_vector">initialization_vector</a></li></ul><h3><ahref="#implementors">Implementors</a></h3></section><h2><ahref="index.html">In halo2_gadgets::sha256</a></h2></div></nav><main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"title="help"tabindex="-1"><ahref="../../help.html">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1class="fqn">Trait <ahref="../index.html">halo2_gadgets</a>::<wbr><ahref="index.html">sha256</a>::<wbr><aclass="trait"href="#">Sha256Instructions</a><buttonid="copy-path"onclick="copy_path(this)"title="Copy item path to clipboard"><imgsrc="../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="srclink"href="../../src/halo2_gadgets/sha256.rs.html#25-57">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><divclass="item-decl"><preclass="rust trait"><code>pub trait Sha256Instructions<F: FieldExt>: Chip<F> {
}</code></pre></div><spanclass="item-info"><divclass="stab portability">Available on <strong>crate feature <code>unstable</code></strong> only.</div></span><detailsclass="rustdoc-toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>The set of circuit instructions required to use the <ahref="struct.Sha256.html"title="Sha256"><code>Sha256</code></a> gadget.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="associatedtype.BlockWord"class="method has-srclink"><aclass="srclink rightside"href="../../src/halo2_gadgets/sha256.rs.html#30">source</a><h4class="code-header">type <ahref="#associatedtype.BlockWord"class="associatedtype">BlockWord</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html"title="trait core::marker::Copy">Copy</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html"title="trait core::default::Default">Default</a></h4></section></summary><divclass="docblock"><p>Variable representing a 32-bit word of the input block to the SHA-256 compression
</div></details></div><h2id="required-methods"class="small-section-header">Required Methods<ahref="#required-methods"class="anchor"></a></h2><divclass="methods"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="tymethod.initialization_vector"class="method has-srclink"><aclass="srclink rightside"href="../../src/halo2_gadgets/sha256.rs.html#33">source</a><h4class="code-header">fn <ahref="#tymethod.initialization_vector"class="fnname">initialization_vector</a>(<br> &self,<br> layouter: &mut impl Layouter<F><br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a>, Error></h4></section></summary><divclass="docblock"><p>Places the SHA-256 IV in the circuit, returning the initial state variable.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="tymethod.initialization"class="method has-srclink"><aclass="srclink rightside"href="../../src/halo2_gadgets/sha256.rs.html#36-40">source</a><h4class="code-header">fn <ahref="#tymethod.initialization"class="fnname">initialization</a>(<br> &self,<br> layouter: &mut impl Layouter<F>,<br> init_state: &Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a><br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a>, Error></h4></section></summary><divclass="docblock"><p>Creates an initial state from the output state of a previous block</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="tymethod.compress"class="method has-srclink"><aclass="srclink rightside"href="../../src/halo2_gadgets/sha256.rs.html#44-49">source</a><h4class="code-header">fn <ahref="#tymethod.compress"class="fnname">compress</a>(<br> &self,<br> layouter: &mut impl Layouter<F>,<br> initialized_state: &Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a>,<br> input: [Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.BlockWord"title="type halo2_gadgets::sha256::Sha256Instructions::BlockWord">BlockWord</a>; <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.array.html">16</a>]<br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a>, Error></h4></section></summary><divclass="docblock"><p>Starting from the given initialized state, processes a block of input and returns the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="tymethod.digest"class="method has-srclink"><aclass="srclink rightside"href="../../src/halo2_gadgets/sha256.rs.html#52-56">source</a><h4class="code-header">fn <ahref="#tymethod.digest"class="fnname">digest</a>(<br> &self,<br> layouter: &mut impl Layouter<F>,<br> state: &Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.State"title="type halo2_gadgets::sha256::Sha256Instructions::State">State</a><br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><[Self::<aclass="associatedtype"href="trait.Sha256Instructions.html#associatedtype.BlockWord"title="type halo2_gadgets::sha256::Sha256Instructions::BlockWord">BlockWord</a>; <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.array.html">8</a>], Error></h4></section></summary><divclass="docblock"><p>Converts the given state into a message digest.</p>