Files
GopherGate/target/doc/rand_core/trait.CryptoRng.html
2026-02-26 12:00:21 -05:00

23 lines
8.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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 marker trait over `RngCore` for securely unpredictable RNGs"><title>CryptoRng in rand_core - 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="rand_core" 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="icon" href="https://www.rust-lang.org/favicon.ico"></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="#">CryptoRng</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Crypto<wbr>Rng</a></h2><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</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">rand_core</a></div><h1>Trait <span class="trait">Crypto<wbr>Rng</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/rand_core/lib.rs.html#204">Source</a> </span></div><pre class="rust item-decl"><code>pub trait CryptoRng: <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A marker trait over <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> for securely unpredictable RNGs</p>
<p>This marker trait indicates that the implementing generator is intended,
when correctly seeded and protected from side-channel attacks such as a
leaking of state, to be a cryptographically secure generator. This trait is
provided as a tool to aid review of cryptographic code, but does not by
itself guarantee suitability for cryptographic applications.</p>
<p>Implementors of <code>CryptoRng</code> automatically implement the <a href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng"><code>TryCryptoRng</code></a>
trait.</p>
<p>Implementors of <code>CryptoRng</code> should only implement <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default"><code>Default</code></a> if the
<code>default()</code> instances are themselves secure generators: for example if the
implementing type is a stateless interface over a secure external generator
(like <a href="struct.OsRng.html" title="struct rand_core::OsRng"><code>OsRng</code></a>) or if the <code>default()</code> instance uses a strong, fresh seed.</p>
<p>Formally, a CSPRNG (Cryptographically Secure Pseudo-Random Number Generator)
should satisfy an additional property over other generators: assuming that
the generator has been appropriately seeded and has unknown state, then
given the first <em>k</em> bits of an algorithms output
sequence, it should not be possible using polynomial-time algorithms to
predict the next bit with probability significantly greater than 50%.</p>
<p>An optional property of CSPRNGs is backtracking resistance: if the CSPRNGs
state is revealed, it will not be computationally-feasible to reconstruct
prior output values. This property is not required by <code>CryptoRng</code>.</p>
</div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-CryptoRng-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#261">Source</a><a href="#impl-CryptoRng-for-BlockRng%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.CryptoBlockRng.html" title="trait rand_core::block::CryptoBlockRng">CryptoBlockRng</a> + <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>&gt;&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-BlockRng64%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#424">Source</a><a href="#impl-CryptoRng-for-BlockRng64%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.CryptoBlockRng.html" title="trait rand_core::block::CryptoBlockRng">CryptoBlockRng</a> + <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>&gt;&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-UnwrapMut%3C'_,+R%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#356">Source</a><a href="#impl-CryptoRng-for-UnwrapMut%3C'_,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">UnwrapMut</a>&lt;'_, R&gt;</h3></section><section id="impl-CryptoRng-for-UnwrapErr%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#317">Source</a><a href="#impl-CryptoRng-for-UnwrapErr%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">UnwrapErr</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-T" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#206">Source</a><a href="#impl-CryptoRng-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for T<div class="where">where
T::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a>,</div></h3></section></div><script src="../trait.impl/rand_core/trait.CryptoRng.js" async></script></section></div></main></body></html>