]> Untitled Git - bitcoindevkit.org/blob
5492568a1eee61fe95b3ec623446b07acf2c6d5b
[bitcoindevkit.org] /
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="A marker trait used to indicate that an `RngCore` or `BlockRngCore` implementation is supposed to be cryptographically secure."><title>CryptoRng in bdk_chain::bitcoin::secp256k1::rand - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="bdk_chain" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (78a775127 2024-05-11)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-2c020d218678b618.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></a><h2><a href="../../../../bdk_chain/index.html">bdk_chain</a><span class="version">0.19.0</span></h2></div><h2 class="location"><a href="#">CryptoRng</a></h2><div class="sidebar-elems"><section><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-CryptoRng-for-%26mut+R">&amp;&#x27;a mut R</a></li><li><a href="#impl-CryptoRng-for-Box%3CR%3E">Box&lt;R&gt;</a></li><li><a href="#impl-CryptoRng-for-ChaCha12Core">ChaCha12Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha12Rng">ChaCha12Rng</a></li><li><a href="#impl-CryptoRng-for-ChaCha20Core">ChaCha20Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha20Rng">ChaCha20Rng</a></li><li><a href="#impl-CryptoRng-for-ChaCha8Core">ChaCha8Core</a></li><li><a href="#impl-CryptoRng-for-ChaCha8Rng">ChaCha8Rng</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In bdk_chain::bitcoin::secp256k1::rand</a></h2></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"><h1>Trait <a href="../../../index.html">bdk_chain</a>::<wbr><a href="../../index.html">bitcoin</a>::<wbr><a href="../index.html">secp256k1</a>::<wbr><a href="index.html">rand</a>::<wbr><a class="trait" href="#">CryptoRng</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="https://rust-random.github.io/rand/src/rand_core/lib.rs.html#209">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></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 bdk_chain::bitcoin::secp256k1::rand::RngCore"><code>RngCore</code></a> or <a href="https://rust-random.github.io/rand/rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a>
2 implementation is supposed to be cryptographically secure.</p>
3 <p><em>Cryptographically secure generators</em>, also known as <em>CSPRNGs</em>, should
4 satisfy an additional properties over other generators: given the first
5 <em>k</em> bits of an algorithm’s output
6 sequence, it should not be possible using polynomial-time algorithms to
7 predict the next bit with probability significantly greater than 50%.</p>
8 <p>Some generators may satisfy an additional property, however this is not
9 required by this trait: if the CSPRNG’s state is revealed, it should not be
10 computationally-feasible to reconstruct output prior to this. Some other
11 generators allow backwards-computation and are considered <em>reversible</em>.</p>
12 <p>Note that this trait is provided for guidance only and cannot guarantee
13 suitability for cryptographic applications. In general it should only be
14 implemented for well-reviewed code implementing well-regarded algorithms.</p>
15 <p>Note also that use of a <code>CryptoRng</code> does not protect against other
16 weaknesses such as seeding from a weak entropy source or leaking state.</p>
17 </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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/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="https://rust-random.github.io/rand/src/rand_core/lib.rs.html#481">source</a><a href="#impl-CryptoRng-for-%26mut+R" class="anchor">§</a><h3 class="code-header">impl&lt;'a, R&gt; <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut R</a><div class="where">where
18 R: <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/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="https://rust-random.github.io/rand/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&lt;R&gt; <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;R&gt;<div class="where">where
19 R: <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/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="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.OsRng.html" title="struct bdk_chain::bitcoin::secp256k1::rand::rngs::OsRng">OsRng</a></h3></section><section id="impl-CryptoRng-for-StdRng" class="impl"><a class="src rightside" href="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.StdRng.html" title="struct bdk_chain::bitcoin::secp256k1::rand::rngs::StdRng">StdRng</a></h3></section><section id="impl-CryptoRng-for-ThreadRng" class="impl"><a class="src rightside" href="https://rust-random.github.io/rand/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 bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/struct.ThreadRng.html" title="struct bdk_chain::bitcoin::secp256k1::rand::rngs::ThreadRng">ThreadRng</a></h3></section><section id="impl-CryptoRng-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="https://rust-random.github.io/rand/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&lt;R&gt; <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="https://rust-random.github.io/rand/rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a>&lt;R&gt;<div class="where">where
20 R: <a class="trait" href="https://rust-random.github.io/rand/rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a>,</div></h3></section><section id="impl-CryptoRng-for-ReseedingRng%3CR,+Rsdr%3E" class="impl"><a class="src rightside" href="https://rust-random.github.io/rand/src/rand/rngs/adapter/reseeding.rs.html#149-152">source</a><a href="#impl-CryptoRng-for-ReseedingRng%3CR,+Rsdr%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R, Rsdr&gt; <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a> for <a class="struct" href="rngs/adapter/struct.ReseedingRng.html" title="struct bdk_chain::bitcoin::secp256k1::rand::rngs::adapter::ReseedingRng">ReseedingRng</a>&lt;R, Rsdr&gt;<div class="where">where
21 R: <a class="trait" href="https://rust-random.github.io/rand/rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::SeedableRng">SeedableRng</a> + <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a>,
22 Rsdr: <a class="trait" href="trait.RngCore.html" title="trait bdk_chain::bitcoin::secp256k1::rand::RngCore">RngCore</a> + <a class="trait" href="trait.CryptoRng.html" title="trait bdk_chain::bitcoin::secp256k1::rand::CryptoRng">CryptoRng</a>,</div></h3></section></div><script src="../../../../trait.impl/rand_core/trait.CryptoRng.js" data-ignore-extern-crates="alloc,rand_core,rand,rand_chacha" async></script></section></div></main></body></html>