mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 08:19:51 +00:00
22 lines
No EOL
13 KiB
HTML
22 lines
No EOL
13 KiB
HTML
<!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 used to indicate that an `RngCore` or `BlockRngCore` implementation is supposed to be cryptographically secure."><title>CryptoRng in rand - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../rand/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand/index.html">rand</a><span class="version">0.8.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="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-CryptoRng-for-%26mut+R" title="&'a mut R">&'a mut R</a></li><li><a href="#impl-CryptoRng-for-Box%3CR%3E" title="Box<R>">Box<R></a></li><li><a href="#impl-CryptoRng-for-ChaCha12Core" title="ChaCha12Core">ChaCha12Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha12Rng" title="ChaCha12Rng">ChaCha12Rng</a></li><li><a href="#impl-CryptoRng-for-ChaCha20Core" title="ChaCha20Core">ChaCha20Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha20Rng" title="ChaCha20Rng">ChaCha20Rng</a></li><li><a href="#impl-CryptoRng-for-ChaCha8Core" title="ChaCha8Core">ChaCha8Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha8Rng" title="ChaCha8Rng">ChaCha8Rng</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 rand</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="index.html">rand</a></span><h1>Trait <span class="trait">CryptoRng</span><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#209">Source</a> </span></div><pre class="rust item-decl"><code>pub trait CryptoRng { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A marker trait used to indicate that an <a href="trait.RngCore.html" title="trait rand::RngCore"><code>RngCore</code></a> or <a href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a>
|
||
implementation is supposed to be cryptographically secure.</p>
|
||
<p><em>Cryptographically secure generators</em>, also known as <em>CSPRNGs</em>, should
|
||
satisfy an additional properties over other generators: given the first
|
||
<em>k</em> bits of an algorithm’s output
|
||
sequence, it should not be possible using polynomial-time algorithms to
|
||
predict the next bit with probability significantly greater than 50%.</p>
|
||
<p>Some generators may satisfy an additional property, however this is not
|
||
required by this trait: if the CSPRNG’s state is revealed, it should not be
|
||
computationally-feasible to reconstruct output prior to this. Some other
|
||
generators allow backwards-computation and are considered <em>reversible</em>.</p>
|
||
<p>Note that this trait is provided for guidance only and cannot guarantee
|
||
suitability for cryptographic applications. In general it should only be
|
||
implemented for well-reviewed code implementing well-regarded algorithms.</p>
|
||
<p>Note also that use of a <code>CryptoRng</code> does not protect against other
|
||
weaknesses such as seeding from a weak entropy source or leaking state.</p>
|
||
</div></details><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><section id="impl-CryptoRng-for-ChaCha8Core" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#345">Source</a><a href="#impl-CryptoRng-for-ChaCha8Core" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Core.html" title="struct rand_chacha::chacha::ChaCha8Core">ChaCha8Core</a></h3></section><section id="impl-CryptoRng-for-ChaCha8Rng" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#345">Source</a><a href="#impl-CryptoRng-for-ChaCha8Rng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Rng.html" title="struct rand_chacha::chacha::ChaCha8Rng">ChaCha8Rng</a></h3></section><section id="impl-CryptoRng-for-ChaCha12Core" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#344">Source</a><a href="#impl-CryptoRng-for-ChaCha12Core" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Core.html" title="struct rand_chacha::chacha::ChaCha12Core">ChaCha12Core</a></h3></section><section id="impl-CryptoRng-for-ChaCha12Rng" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#344">Source</a><a href="#impl-CryptoRng-for-ChaCha12Rng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Rng.html" title="struct rand_chacha::chacha::ChaCha12Rng">ChaCha12Rng</a></h3></section><section id="impl-CryptoRng-for-ChaCha20Core" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#343">Source</a><a href="#impl-CryptoRng-for-ChaCha20Core" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Core.html" title="struct rand_chacha::chacha::ChaCha20Core">ChaCha20Core</a></h3></section><section id="impl-CryptoRng-for-ChaCha20Rng" class="impl"><a class="src rightside" href="../src/rand_chacha/chacha.rs.html#343">Source</a><a href="#impl-CryptoRng-for-ChaCha20Rng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Rng.html" title="struct rand_chacha::chacha::ChaCha20Rng">ChaCha20Rng</a></h3></section><section id="impl-CryptoRng-for-%26mut+R" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#481">Source</a><a href="#impl-CryptoRng-for-%26mut+R" class="anchor">§</a><h3 class="code-header">impl<'a, R> <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&'a mut R</a><div class="where">where
|
||
R: <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section><section id="impl-CryptoRng-for-Box%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#485">Source</a><a href="#impl-CryptoRng-for-Box%3CR%3E" class="anchor">§</a><h3 class="code-header">impl<R> <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://doc.rust-lang.org/1.84.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><R><div class="where">where
|
||
R: <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-CryptoRng-for-OsRng" class="impl"><a class="src rightside" href="../src/rand_core/os.rs.html#50">Source</a><a href="#impl-CryptoRng-for-OsRng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.OsRng.html" title="struct rand::rngs::OsRng">OsRng</a></h3></section><section id="impl-CryptoRng-for-StdRng" class="impl"><a class="src rightside" href="../src/rand/rngs/std.rs.html#72">Source</a><a href="#impl-CryptoRng-for-StdRng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.StdRng.html" title="struct rand::rngs::StdRng">StdRng</a></h3></section><section id="impl-CryptoRng-for-ThreadRng" class="impl"><a class="src rightside" href="../src/rand/rngs/thread.rs.html#131">Source</a><a href="#impl-CryptoRng-for-ThreadRng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.ThreadRng.html" title="struct rand::rngs::ThreadRng">ThreadRng</a></h3></section><section id="impl-CryptoRng-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#431">Source</a><a href="#impl-CryptoRng-for-BlockRng%3CR%3E" class="anchor">§</a><h3 class="code-header">impl<R> <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R><div class="where">where
|
||
R: <a class="trait" href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a>,</div></h3></section><section id="impl-CryptoRng-for-ReseedingRng%3CR,+Rsdr%3E" class="impl"><a class="src rightside" href="../src/rand/rngs/adapter/reseeding.rs.html#149-154">Source</a><a href="#impl-CryptoRng-for-ReseedingRng%3CR,+Rsdr%3E" class="anchor">§</a><h3 class="code-header">impl<R, Rsdr> <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/adapter/struct.ReseedingRng.html" title="struct rand::rngs::adapter::ReseedingRng">ReseedingRng</a><R, Rsdr><div class="where">where
|
||
R: <a class="trait" href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> + <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a>,
|
||
Rsdr: <a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a> + <a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a>,</div></h3></section></div><script src="../trait.impl/rand_core/trait.CryptoRng.js" data-ignore-extern-crates="rand_core,alloc,rand_chacha" async></script></section></div></main></body></html> |