Adding large folders

This commit is contained in:
2026-02-26 12:00:21 -05:00
parent 5400d82acd
commit 49701c85ad
47332 changed files with 1942573 additions and 0 deletions

View File

@@ -0,0 +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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="subtle" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">All</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../subtle/index.html"><img src="https://doc.dalek.rs/assets/dalek-logo-clear.png" alt="logo"></a><h2><a href="../subtle/index.html">subtle</a><span class="version">2.6.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>List of all items</h1><rustdoc-toolbar></rustdoc-toolbar></div><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.BlackBox.html">BlackBox</a></li><li><a href="struct.Choice.html">Choice</a></li><li><a href="struct.CtOption.html">CtOption</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.ConditionallyNegatable.html">ConditionallyNegatable</a></li><li><a href="trait.ConditionallySelectable.html">ConditionallySelectable</a></li><li><a href="trait.ConstantTimeEq.html">ConstantTimeEq</a></li><li><a href="trait.ConstantTimeGreater.html">ConstantTimeGreater</a></li><li><a href="trait.ConstantTimeLess.html">ConstantTimeLess</a></li></ul></section></div></main></body></html>

View File

@@ -0,0 +1,53 @@
<!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="subtle "><title>subtle - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="subtle" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate subtle</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../subtle/index.html"><img src="https://doc.dalek.rs/assets/dalek-logo-clear.png" alt="logo"></a><h2><a href="../subtle/index.html">subtle</a><span class="version">2.6.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#subtle---" title="subtle ">subtle </a><ul><li><a href="#documentation" title="Documentation">Documentation</a></li><li><a href="#minimum-supported-rust-version" title="Minimum Supported Rust Version">Minimum Supported Rust Version</a></li><li><a href="#about" title="About">About</a></li><li><a href="#warning" title="Warning">Warning</a></li></ul></li></ul><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>subtle</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/subtle/lib.rs.html#11-1008">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="subtle---"><a class="doc-anchor" href="#subtle---">§</a>subtle <a href="https://crates.io/crates/subtle"><img src="https://img.shields.io/crates/v/subtle.svg" alt="" /></a> <a href="https://doc.dalek.rs/subtle"><img src="https://img.shields.io/badge/dynamic/json.svg?label=docs&amp;uri=https%3A%2F%2Fcrates.io%2Fapi%2Fv1%2Fcrates%2Fsubtle%2Fversions&amp;query=%24.versions%5B0%5D.num&amp;colorB=4F74A6" alt="" /></a> <a href="https://travis-ci.org/dalek-cryptography/subtle"><img src="https://travis-ci.org/dalek-cryptography/subtle.svg?branch=master" alt="" /></a></h2>
<p><strong>Pure-Rust traits and utilities for constant-time cryptographic implementations.</strong></p>
<p>It consists of a <code>Choice</code> type, and a collection of traits using <code>Choice</code>
instead of <code>bool</code> which are intended to execute in constant-time. The <code>Choice</code>
type is a wrapper around a <code>u8</code> that holds a <code>0</code> or <code>1</code>.</p>
<div class="example-wrap"><pre class="language-toml"><code>subtle = &quot;2.6&quot;</code></pre></div>
<p>This crate represents a “best-effort” attempt, since side-channels
are ultimately a property of a deployed cryptographic system
including the hardware it runs on, not just of software.</p>
<p>The traits are implemented using bitwise operations, and should execute in
constant time provided that a) the bitwise operations are constant-time and
b) the bitwise operations are not recognized as a conditional assignment and
optimized back into a branch.</p>
<p>For a compiler to recognize that bitwise operations represent a conditional
assignment, it needs to know that the value used to generate the bitmasks is
really a boolean <code>i1</code> rather than an <code>i8</code> byte value. In an attempt to
prevent this refinement, the crate tries to hide the value of a <code>Choice</code>s
inner <code>u8</code> by passing it through a volatile read. For more information, see
the <em>About</em> section below.</p>
<p>Rust versions from 1.51 or higher have const generics support. You may enable
<code>const-generics</code> feautre to have <code>subtle</code> traits implemented for arrays <code>[T; N]</code>.</p>
<p>Versions prior to <code>2.2</code> recommended use of the <code>nightly</code> feature to enable an
optimization barrier; this is not required in versions <code>2.2</code> and above.</p>
<p>Note: the <code>subtle</code> crate contains <code>debug_assert</code>s to check invariants during
debug builds. These invariant checks involve secret-dependent branches, and
are not present when compiled in release mode. This crate is intended to be
used in release mode.</p>
<h3 id="documentation"><a class="doc-anchor" href="#documentation">§</a>Documentation</h3>
<p>Documentation is available <a href="https://docs.rs/subtle">here</a>.</p>
<h3 id="minimum-supported-rust-version"><a class="doc-anchor" href="#minimum-supported-rust-version">§</a>Minimum Supported Rust Version</h3>
<p>Rust <strong>1.41</strong> or higher.</p>
<p>Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.</p>
<h3 id="about"><a class="doc-anchor" href="#about">§</a>About</h3>
<p>This library aims to be the Rust equivalent of Gos <code>crypto/subtle</code> module.</p>
<p>Old versions of the optimization barrier in <code>impl From&lt;u8&gt; for Choice</code> were
based on Tim Macleans <a href="https://www.chosenplaintext.ca/open-source/rust-timing-shield/security">work on <code>rust-timing-shield</code></a>,
which attempts to provide a more comprehensive approach for preventing
software side-channels in Rust code.
From version <code>2.2</code>, it was based on Diane Hosfelt and Amber Sprenkels work on
“Secret Types in Rust”.</p>
<p><code>subtle</code> is authored by isis agora lovecruft and Henry de Valence.</p>
<h3 id="warning"><a class="doc-anchor" href="#warning">§</a>Warning</h3>
<p>This code is a low-level library, intended for specific use-cases implementing
cryptographic protocols. It represents a best-effort attempt to protect
against some software side-channels. Because side-channel resistance is not a
property of software alone, but of software together with hardware, any such
effort is fundamentally limited.</p>
<p><strong>USE AT YOUR OWN RISK</strong></p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BlackBox.html" title="struct subtle::BlackBox">Black<wbr>Box</a></dt><dd>Wrapper type which implements an optimization barrier for all accesses.</dd><dt><a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></dt><dd>The <code>Choice</code> struct represents a choice for use in conditional assignment.</dd><dt><a class="struct" href="struct.CtOption.html" title="struct subtle::CtOption">CtOption</a></dt><dd>The <code>CtOption&lt;T&gt;</code> type represents an optional value similar to the
<a href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option"><code>Option&lt;T&gt;</code></a> type but is intended for
use in constant time APIs.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.ConditionallyNegatable.html" title="trait subtle::ConditionallyNegatable">Conditionally<wbr>Negatable</a></dt><dd>A type which can be conditionally negated in constant time.</dd><dt><a class="trait" href="trait.ConditionallySelectable.html" title="trait subtle::ConditionallySelectable">Conditionally<wbr>Selectable</a></dt><dd>A type which can be conditionally selected in constant time.</dd><dt><a class="trait" href="trait.ConstantTimeEq.html" title="trait subtle::ConstantTimeEq">Constant<wbr>Time<wbr>Eq</a></dt><dd>An <code>Eq</code>-like trait that produces a <code>Choice</code> instead of a <code>bool</code>.</dd><dt><a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">Constant<wbr>Time<wbr>Greater</a></dt><dd>A type which can be compared in some manner and be determined to be greater
than another of the same type.</dd><dt><a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">Constant<wbr>Time<wbr>Less</a></dt><dd>A type which can be compared in some manner and be determined to be less
than another of the same type.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BlackBox","Choice","CtOption"],"trait":["ConditionallyNegatable","ConditionallySelectable","ConstantTimeEq","ConstantTimeGreater","ConstantTimeLess"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
<!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 type which can be conditionally negated in constant time."><title>ConditionallyNegatable in subtle - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="subtle" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">ConditionallyNegatable</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../subtle/index.html"><img src="https://doc.dalek.rs/assets/dalek-logo-clear.png" alt="logo"></a><h2><a href="../subtle/index.html">subtle</a><span class="version">2.6.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Conditionally<wbr>Negatable</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#note" title="Note">Note</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.conditional_negate" title="conditional_negate">conditional_negate</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate subtle</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">subtle</a></div><h1>Trait <span class="trait">Conditionally<wbr>Negatable</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/subtle/lib.rs.html#604-612">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ConditionallyNegatable {
// Required method
fn <a href="#tymethod.conditional_negate" class="fn">conditional_negate</a>(&amp;mut self, choice: <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a>);
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type which can be conditionally negated in constant time.</p>
<h2 id="note"><a class="doc-anchor" href="#note">§</a>Note</h2>
<p>A generic implementation of <code>ConditionallyNegatable</code> is provided
for types <code>T</code> which are <code>ConditionallySelectable</code> and have <code>Neg</code>
implemented on <code>&amp;T</code>.</p>
</div></details><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.conditional_negate" class="method"><a class="src rightside" href="../src/subtle/lib.rs.html#611">Source</a><h4 class="code-header">fn <a href="#tymethod.conditional_negate" class="fn">conditional_negate</a>(&amp;mut self, choice: <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a>)</h4></section></summary><div class="docblock"><p>Negate <code>self</code> if <code>choice == Choice(1)</code>; otherwise, leave it
unchanged.</p>
<p>This function should execute in constant time.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ConditionallyNegatable-for-T" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#614-625">Source</a><a href="#impl-ConditionallyNegatable-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.ConditionallyNegatable.html" title="trait subtle::ConditionallyNegatable">ConditionallyNegatable</a> for T<div class="where">where
T: <a class="trait" href="trait.ConditionallySelectable.html" title="trait subtle::ConditionallySelectable">ConditionallySelectable</a>,
for&lt;'a&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.reference.html">&amp;'a T</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a>&lt;Output = T&gt;,</div></h3></section></div><script src="../trait.impl/subtle/trait.ConditionallyNegatable.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
<!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 type which can be compared in some manner and be determined to be greater than another of the same type."><title>ConstantTimeGreater in subtle - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="subtle" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">ConstantTimeGreater</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../subtle/index.html"><img src="https://doc.dalek.rs/assets/dalek-logo-clear.png" alt="logo"></a><h2><a href="../subtle/index.html">subtle</a><span class="version">2.6.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Constant<wbr>Time<wbr>Greater</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.ct_gt" title="ct_gt">ct_gt</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-ConstantTimeGreater-for-Ordering" title="Ordering">Ordering</a></li><li><a href="#impl-ConstantTimeGreater-for-u8" title="u8">u8</a></li><li><a href="#impl-ConstantTimeGreater-for-u16" title="u16">u16</a></li><li><a href="#impl-ConstantTimeGreater-for-u32" title="u32">u32</a></li><li><a href="#impl-ConstantTimeGreater-for-u64" title="u64">u64</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate subtle</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">subtle</a></div><h1>Trait <span class="trait">Constant<wbr>Time<wbr>Greater</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/subtle/lib.rs.html#843-877">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ConstantTimeGreater {
// Required method
fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type which can be compared in some manner and be determined to be greater
than another of the same type.</p>
</div></details><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.ct_gt" class="method"><a class="src rightside" href="../src/subtle/lib.rs.html#876">Source</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Determine whether <code>self &gt; other</code>.</p>
<p>The bitwise-NOT of the return value of this function should be usable to
determine if <code>self &lt;= other</code>.</p>
<p>This function should execute in constant time.</p>
<h5 id="returns"><a class="doc-anchor" href="#returns">§</a>Returns</h5>
<p>A <code>Choice</code> with a set bit if <code>self &gt; other</code>, and with no set bits
otherwise.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>subtle::ConstantTimeGreater;
<span class="kw">let </span>x: u8 = <span class="number">13</span>;
<span class="kw">let </span>y: u8 = <span class="number">42</span>;
<span class="kw">let </span>x_gt_y = x.ct_gt(<span class="kw-2">&amp;</span>y);
<span class="macro">assert_eq!</span>(x_gt_y.unwrap_u8(), <span class="number">0</span>);
<span class="kw">let </span>y_gt_x = y.ct_gt(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(y_gt_x.unwrap_u8(), <span class="number">1</span>);
<span class="kw">let </span>x_gt_x = x.ct_gt(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(x_gt_x.unwrap_u8(), <span class="number">0</span>);</code></pre></div></div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeGreater-for-Ordering" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#921-929">Source</a><a href="#impl-ConstantTimeGreater-for-Ordering" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> for <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h3></section></summary><div class="impl-items"><section id="method.ct_gt" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#923-928">Source</a><a href="#method.ct_gt" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeGreater-for-u8" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#914">Source</a><a href="#impl-ConstantTimeGreater-for-u8" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u8.html">u8</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.ct_gt-1" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#914">Source</a><a href="#method.ct_gt-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u8.html">u8</a>) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Returns Choice::from(1) iff x &gt; y, and Choice::from(0) iff x &lt;= y.</p>
<h5 id="note"><a class="doc-anchor" href="#note">§</a>Note</h5>
<p>This algoritm would also work for signed integers if we first
flip the top bit, e.g. <code>let x: u8 = x ^ 0x80</code>, etc.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeGreater-for-u16" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#915">Source</a><a href="#impl-ConstantTimeGreater-for-u16" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u16.html">u16</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.ct_gt-2" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#915">Source</a><a href="#method.ct_gt-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u16.html">u16</a>) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Returns Choice::from(1) iff x &gt; y, and Choice::from(0) iff x &lt;= y.</p>
<h5 id="note-1"><a class="doc-anchor" href="#note-1">§</a>Note</h5>
<p>This algoritm would also work for signed integers if we first
flip the top bit, e.g. <code>let x: u8 = x ^ 0x80</code>, etc.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeGreater-for-u32" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#916">Source</a><a href="#impl-ConstantTimeGreater-for-u32" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u32.html">u32</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.ct_gt-3" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#916">Source</a><a href="#method.ct_gt-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u32.html">u32</a>) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Returns Choice::from(1) iff x &gt; y, and Choice::from(0) iff x &lt;= y.</p>
<h5 id="note-2"><a class="doc-anchor" href="#note-2">§</a>Note</h5>
<p>This algoritm would also work for signed integers if we first
flip the top bit, e.g. <code>let x: u8 = x ^ 0x80</code>, etc.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeGreater-for-u64" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#917">Source</a><a href="#impl-ConstantTimeGreater-for-u64" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u64.html">u64</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.ct_gt-4" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#917">Source</a><a href="#method.ct_gt-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.ct_gt" class="fn">ct_gt</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Returns Choice::from(1) iff x &gt; y, and Choice::from(0) iff x &lt;= y.</p>
<h5 id="note-3"><a class="doc-anchor" href="#note-3">§</a>Note</h5>
<p>This algoritm would also work for signed integers if we first
flip the top bit, e.g. <code>let x: u8 = x ^ 0x80</code>, etc.</p>
</div></details></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../trait.impl/subtle/trait.ConstantTimeGreater.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,31 @@
<!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 type which can be compared in some manner and be determined to be less than another of the same type."><title>ConstantTimeLess in subtle - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="subtle" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">ConstantTimeLess</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../subtle/index.html"><img src="https://doc.dalek.rs/assets/dalek-logo-clear.png" alt="logo"></a><h2><a href="../subtle/index.html">subtle</a><span class="version">2.6.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Constant<wbr>Time<wbr>Less</a></h2><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.ct_lt" title="ct_lt">ct_lt</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-ConstantTimeLess-for-Ordering" title="Ordering">Ordering</a></li><li><a href="#impl-ConstantTimeLess-for-u8" title="u8">u8</a></li><li><a href="#impl-ConstantTimeLess-for-u16" title="u16">u16</a></li><li><a href="#impl-ConstantTimeLess-for-u32" title="u32">u32</a></li><li><a href="#impl-ConstantTimeLess-for-u64" title="u64">u64</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate subtle</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">subtle</a></div><h1>Trait <span class="trait">Constant<wbr>Time<wbr>Less</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/subtle/lib.rs.html#933-973">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ConstantTimeLess: <a class="trait" href="trait.ConstantTimeEq.html" title="trait subtle::ConstantTimeEq">ConstantTimeEq</a> + <a class="trait" href="trait.ConstantTimeGreater.html" title="trait subtle::ConstantTimeGreater">ConstantTimeGreater</a> {
// Provided method
fn <a href="#method.ct_lt" class="fn">ct_lt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type which can be compared in some manner and be determined to be less
than another of the same type.</p>
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.ct_lt" class="method"><a class="src rightside" href="../src/subtle/lib.rs.html#970-972">Source</a><h4 class="code-header">fn <a href="#method.ct_lt" class="fn">ct_lt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></summary><div class="docblock"><p>Determine whether <code>self &lt; other</code>.</p>
<p>The bitwise-NOT of the return value of this function should be usable to
determine if <code>self &gt;= other</code>.</p>
<p>A default implementation is provided and implemented for the unsigned
integer types.</p>
<p>This function should execute in constant time.</p>
<h5 id="returns"><a class="doc-anchor" href="#returns">§</a>Returns</h5>
<p>A <code>Choice</code> with a set bit if <code>self &lt; other</code>, and with no set bits
otherwise.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>subtle::ConstantTimeLess;
<span class="kw">let </span>x: u8 = <span class="number">13</span>;
<span class="kw">let </span>y: u8 = <span class="number">42</span>;
<span class="kw">let </span>x_lt_y = x.ct_lt(<span class="kw-2">&amp;</span>y);
<span class="macro">assert_eq!</span>(x_lt_y.unwrap_u8(), <span class="number">1</span>);
<span class="kw">let </span>y_lt_x = y.ct_lt(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(y_lt_x.unwrap_u8(), <span class="number">0</span>);
<span class="kw">let </span>x_lt_x = x.ct_lt(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(x_lt_x.unwrap_u8(), <span class="number">0</span>);</code></pre></div></div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-ConstantTimeLess-for-Ordering" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#982-990">Source</a><a href="#impl-ConstantTimeLess-for-Ordering" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">ConstantTimeLess</a> for <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h3></section></summary><div class="impl-items"><section id="method.ct_lt-1" class="method trait-impl"><a class="src rightside" href="../src/subtle/lib.rs.html#984-989">Source</a><a href="#method.ct_lt-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.ct_lt" class="fn">ct_lt</a>(&amp;self, other: &amp;Self) -&gt; <a class="struct" href="struct.Choice.html" title="struct subtle::Choice">Choice</a></h4></section></div></details><section id="impl-ConstantTimeLess-for-u8" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#975">Source</a><a href="#impl-ConstantTimeLess-for-u8" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">ConstantTimeLess</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u8.html">u8</a></h3></section><section id="impl-ConstantTimeLess-for-u16" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#976">Source</a><a href="#impl-ConstantTimeLess-for-u16" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">ConstantTimeLess</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u16.html">u16</a></h3></section><section id="impl-ConstantTimeLess-for-u32" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#977">Source</a><a href="#impl-ConstantTimeLess-for-u32" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">ConstantTimeLess</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u32.html">u32</a></h3></section><section id="impl-ConstantTimeLess-for-u64" class="impl"><a class="src rightside" href="../src/subtle/lib.rs.html#978">Source</a><a href="#impl-ConstantTimeLess-for-u64" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ConstantTimeLess.html" title="trait subtle::ConstantTimeLess">ConstantTimeLess</a> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/core/primitive.u64.html">u64</a></h3></section><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../trait.impl/subtle/trait.ConstantTimeLess.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>