pub struct ChunkOpener<'a> { /* private fields */ }Expand description
Reusable per-chunk responder state for building round-2 openings.
Building the Bao outboard and the nonced block-tree leaves each hash the full chunk. When one challenge opens several blocks of the same chunk (the normal random + final pair, plus any duplicates), doing that work once and serving every opening from it keeps a multi-opening challenge to a single hashing pass over the bytes instead of one per opening (V2-685 round-2 amplification fix).
Implementations§
Source§impl<'a> ChunkOpener<'a>
impl<'a> ChunkOpener<'a>
Sourcepub fn new(
nonce: &[u8; 32],
peer: &[u8; 32],
key: &XorName,
content: &'a [u8],
) -> Self
pub fn new( nonce: &[u8; 32], peer: &[u8; 32], key: &XorName, content: &'a [u8], ) -> Self
Build the chunk’s reusable opening state once: its Bao outboard and its nonced block-leaves (two hash passes over the resident chunk). Repeated openings of the same chunk reuse this state instead of rehashing per opening.
Sourcepub fn block_count(&self) -> u32
pub fn block_count(&self) -> u32
Number of 1 KiB blocks in the chunk (always ≥ 1).
Auto Trait Implementations§
impl<'a> Freeze for ChunkOpener<'a>
impl<'a> RefUnwindSafe for ChunkOpener<'a>
impl<'a> Send for ChunkOpener<'a>
impl<'a> Sync for ChunkOpener<'a>
impl<'a> Unpin for ChunkOpener<'a>
impl<'a> UnsafeUnpin for ChunkOpener<'a>
impl<'a> UnwindSafe for ChunkOpener<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more