<!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 ECC gadgets."><metaname="keywords"content="rust, rustlang, rust-lang, EccInstructions"><title>EccInstructions in halo2_gadgets::ecc - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../SourceSerif4-Regular.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../FiraSans-Regular.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../FiraSans-Medium.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../SourceCodePro-Regular.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../SourceSerif4-Bold.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../SourceCodePro-Semibold.ttf.woff2"><linkrel="stylesheet"type="text/css"href="../../normalize.css"><linkrel="stylesheet"type="text/css"href="../../rustdoc.css"id="mainThemeStyle"><linkrel="stylesheet"type="text/css"href="../../ayu.css"disabled><linkrel="stylesheet"type="text/css"href="../../dark.css"disabled><linkrel="stylesheet"type="text/css"href="../../light.css"id="themeStyle"><scriptid="default-settings"></script><scriptsrc="../../storage.js"></script><scriptsrc="../../crates.js"></script><scriptdefersrc="../../main.js"></script>
</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="../../rust-logo.svg"alt="logo"></div>
</a><h2class="location"><ahref="#">EccInstructions</a></h2><divclass="sidebar-elems"><section><divclass="block"><h3class="sidebar-title"><ahref="#required-associated-types">Required Associated Types</a></h3><ul><li><ahref="#associatedtype.FixedPoints">FixedPoints</a></li><li><ahref="#associatedtype.NonIdentityPoint">NonIdentityPoint</a></li><li><ahref="#associatedtype.Point">Point</a></li><li><ahref="#associatedtype.ScalarFixed">ScalarFixed</a></li><li><ahref="#associatedtype.ScalarFixedShort">ScalarFixedShort</a></li><li><ahref="#associatedtype.ScalarVar">ScalarVar</a></li><li><ahref="#associatedtype.X">X</a></li></ul></div><divclass="block"><h3class="sidebar-title"><ahref="#required-methods">Required Methods</a></h3><ul><li><ahref="#tymethod.add">add</a></li><li><ahref="#tymethod.add_incomplete">add_incomplete</a></li><li><ahref="#tymethod.constrain_equal">constrain_equal</a></li><li><ahref="#tymethod.extract_p">extract_p</a></li><li><ahref="#tymethod.mul">mul</a></li><li><ahref="#tymethod.mul_fixed">mul_fixed</a></li><li><ahref="#tymethod.mul_fixed_base_field_elem">mul_fixed_base_field_elem</a></li><li><ahref="#tymethod.mul_fixed_short">mul_fixed_short</a></li><li><ahref="#tymethod.scalar_fixed_from_signed_short">scalar_fixed_from_signed_short</a></li><li><ahref="#tymethod.witness_point">witness_point</a></li><li><ahref="#tymethod.witness_point_non_id">witness_point_non_id</a></li><li><ahref="#tymethod.witness_scalar_fixed">witness_scalar_fixed</a></li><li><ahref="#tymethod.witness_scalar_var">witness_scalar_var</a></li></ul></div><divclass="block"><h3class="sidebar-title"><ahref="#implementors">Implementors</a></h3></div></section><h2class="location"><ahref="index.html">In halo2_gadgets::ecc</a></h2><divid="sidebar-vars"data-name="EccInstructions"data-ty="trait"data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><main><divclass="width-limiter"><divclass="sub-container"><aclass="sub-logo-container"href="../../halo2_gadgets/index.html"><imgclass="rust-logo"src="../../rust-logo.svg"alt="logo"></a><navclass="sub"><divclass="theme-picker hidden"><buttonid="theme-picker"aria-label="Pick another theme!"aria-haspopup="menu"title="themes"><imgwidth="22"height="22"alt="Pick another theme!"src="../../brush.svg"></button><divid="theme-choices"role="menu"></div></div><formclass="search-form"><divclass="search-container"><span></span><inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><buttontype="button"id="help-button"title="help">?</button><aid="settings-menu"href="../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../wheel.svg"></a></div></form></nav></div><sectionid="main-content"class="content"><divclass="main-heading">
type <ahref="#associatedtype.NonIdentityPoint"class="associatedtype">NonIdentityPoint</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a>;
type <ahref="#associatedtype.X"class="associatedtype">X</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a>;
type <ahref="#associatedtype.FixedPoints"class="associatedtype">FixedPoints</a>: <aclass="trait"href="trait.FixedPoints.html"title="trait halo2_gadgets::ecc::FixedPoints">FixedPoints</a><C>;
</details>}</code></pre></div><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 ECC gadgets.</p>
</div></details><h2id="required-associated-types"class="small-section-header">Required Associated Types<ahref="#required-associated-types"class="anchor"></a></h2><divclass="methods"><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.ScalarVar"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#24">source</a></div><h4class="code-header">type <ahref="#associatedtype.ScalarVar"class="associatedtype">ScalarVar</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a></h4></div></summary><divclass="docblock"><p>Variable representing a scalar used in variable-base scalar mul.</p>
<p>This type is treated as a full-width scalar. However, if <code>Self</code> implements
<ahref="trait.BaseFitsInScalarInstructions.html"title="BaseFitsInScalarInstructions"><code>BaseFitsInScalarInstructions</code></a> then this may also be constructed from an element
of the base field.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.ScalarFixed"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#27">source</a></div><h4class="code-header">type <ahref="#associatedtype.ScalarFixed"class="associatedtype">ScalarFixed</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a></h4></div></summary><divclass="docblock"><p>Variable representing a full-width element of the elliptic curve’s
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.ScalarFixedShort"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#32">source</a></div><h4class="code-header">type <ahref="#associatedtype.ScalarFixedShort"class="associatedtype">ScalarFixedShort</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a></h4></div></summary><divclass="docblock"><p>Variable representing a signed short element of the elliptic curve’s
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.X"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#39">source</a></div><h4class="code-header">type <ahref="#associatedtype.X"class="associatedtype">X</a>: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a></h4></div></summary><divclass="docblock"><p>Variable representing the affine short Weierstrass x-coordinate of an
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.FixedPoints"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#44">source</a></div><h4class="code-header">type <ahref="#associatedtype.FixedPoints"class="associatedtype">FixedPoints</a>: <aclass="trait"href="trait.FixedPoints.html"title="trait halo2_gadgets::ecc::FixedPoints">FixedPoints</a><C></h4></div></summary><divclass="docblock"><p>Enumeration of the set of fixed bases to be used in scalar mul.
</div></details></div><h2id="required-methods"class="small-section-header">Required Methods<ahref="#required-methods"class="anchor"></a></h2><divclass="methods"><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.constrain_equal"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#47-52">source</a></div><h4class="code-header">fn <ahref="#tymethod.constrain_equal"class="fnname">constrain_equal</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> a: &Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a>, <br> b: &Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a><br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Constrains point <code>a</code> to be equal in value to point <code>b</code>.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.witness_point"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#57-61">source</a></div><h4class="code-header">fn <ahref="#tymethod.witness_point"class="fnname">witness_point</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> value: <aclass="enum"href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"title="enum core::option::Option">Option</a><C><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.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Witnesses the given point as a private input to the circuit.
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.witness_point_non_id"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#65-69">source</a></div><h4class="code-header">fn <ahref="#tymethod.witness_point_non_id"class="fnname">witness_point_non_id</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> value: <aclass="enum"href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"title="enum core::option::Option">Option</a><C><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.EccInstructions.html#associatedtype.NonIdentityPoint"title="type halo2_gadgets::ecc::EccInstructions::NonIdentityPoint">NonIdentityPoint</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Witnesses the given point as a private input to the circuit.
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.witness_scalar_var"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#72-76">source</a></div><h4class="code-header">fn <ahref="#tymethod.witness_scalar_var"class="fnname">witness_scalar_var</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> value: <aclass="enum"href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"title="enum core::option::Option">Option</a><C::Scalar><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.EccInstructions.html#associatedtype.ScalarVar"title="type halo2_gadgets::ecc::EccInstructions::ScalarVar">ScalarVar</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Witnesses a full-width scalar to be used in variable-base multiplication.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.witness_scalar_fixed"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#79-83">source</a></div><h4class="code-header">fn <ahref="#tymethod.witness_scalar_fixed"class="fnname">witness_scalar_fixed</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> value: <aclass="enum"href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"title="enum core::option::Option">Option</a><C::Scalar><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.EccInstructions.html#associatedtype.ScalarFixed"title="type halo2_gadgets::ecc::EccInstructions::ScalarFixed">ScalarFixed</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Witnesses a full-width scalar to be used in fixed-base multiplication.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.scalar_fixed_from_signed_short"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#87-91">source</a></div><h4class="code-header">fn <ahref="#tymethod.scalar_fixed_from_signed_short"class="fnname">scalar_fixed_from_signed_short</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> magnitude_sign: <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<aclass="associatedtype"href="../utilities/trait.UtilitiesInstructions.html#associatedtype.Var"title="type halo2_gadgets::utilities::UtilitiesInstructions::Var">Var</a>, Self::<aclass="associatedtype"href="../utilities/trait.UtilitiesInstructions.html#associatedtype.Var"title="type halo2_gadgets::utilities::UtilitiesInstructions::Var">Var</a><aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</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.EccInstructions.html#associatedtype.ScalarFixedShort"title="type halo2_gadgets::ecc::EccInstructions::ScalarFixedShort">ScalarFixedShort</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Converts a magnitude and sign that exists as variables in the circuit into a
signed short scalar to be used in fixed-base scalar multiplication.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.extract_p"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#94">source</a></div><h4class="code-header">fn <ahref="#tymethod.extract_p"class="fnname">extract_p</a><Point: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a>> + <aclass="trait"href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>>(point: <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Point) -> Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.X"title="type halo2_gadgets::ecc::EccInstructions::X">X</a></h4></div></summary><divclass="docblock"><p>Extracts the x-coordinate of a point.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.mul_fixed_short"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#132-137">source</a></div><h4class="code-header">fn <ahref="#tymethod.mul_fixed_short"class="fnname">mul_fixed_short</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> scalar: &Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.ScalarFixedShort"title="type halo2_gadgets::ecc::EccInstructions::ScalarFixedShort">ScalarFixedShort</a>, <br> base: &<Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.FixedPoints"title="type halo2_gadgets::ecc::EccInstructions::FixedPoints">FixedPoints</a> as <aclass="trait"href="trait.FixedPoints.html"title="trait halo2_gadgets::ecc::FixedPoints">FixedPoints</a><C>>::<aclass="associatedtype"href="trait.FixedPoints.html#associatedtype.ShortScalar"title="type halo2_gadgets::ecc::FixedPoints::ShortScalar">ShortScalar</a><br>) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a>, Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.ScalarFixedShort"title="type halo2_gadgets::ecc::EccInstructions::ScalarFixedShort">ScalarFixedShort</a><aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Performs fixed-base scalar multiplication using a short signed scalar, returning
<code>[scalar] base</code>.</p>
</div></details><detailsclass="rustdoc-toggle"open><summary><divid="tymethod.mul_fixed_base_field_elem"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../../src/halo2_gadgets/ecc.rs.html#142-147">source</a></div><h4class="code-header">fn <ahref="#tymethod.mul_fixed_base_field_elem"class="fnname">mul_fixed_base_field_elem</a>(<br> &self, <br> layouter: &mut impl <aclass="trait"href="../../halo2_proofs/circuit/trait.Layouter.html"title="trait halo2_proofs::circuit::Layouter">Layouter</a><C::Base>, <br> base_field_elem: Self::<aclass="associatedtype"href="../utilities/trait.UtilitiesInstructions.html#associatedtype.Var"title="type halo2_gadgets::utilities::UtilitiesInstructions::Var">Var</a>, <br> base: &<Self::<aclass="associatedtype"href="trait.EccInstructions.html#associatedtype.FixedPoints"title="type halo2_gadgets::ecc::EccInstructions::FixedPoints">FixedPoints</a> as <aclass="trait"href="trait.FixedPoints.html"title="trait halo2_gadgets::ecc::FixedPoints">FixedPoints</a><C>>::<aclass="associatedtype"href="trait.FixedPoints.html#associatedtype.Base"title="type halo2_gadgets::ecc::FixedPoints::Base">Base</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.EccInstructions.html#associatedtype.Point"title="type halo2_gadgets::ecc::EccInstructions::Point">Point</a>, <aclass="enum"href="../../halo2_proofs/plonk/error/enum.Error.html"title="enum halo2_proofs::plonk::error::Error">Error</a>></h4></div></summary><divclass="docblock"><p>Performs fixed-base scalar multiplication using a base field element as the scalar.