pub struct NsAvidMScheme;
Expand description
Dummy struct for namespaced AvidM scheme
Implementations§
Source§impl NsAvidMScheme
impl NsAvidMScheme
Sourcepub fn setup(
recovery_threshold: usize,
total_weights: usize,
) -> Result<NsAvidMParam, VidError>
pub fn setup( recovery_threshold: usize, total_weights: usize, ) -> Result<NsAvidMParam, VidError>
Setup an instance for AVID-M scheme
Sourcepub fn commit(
param: &NsAvidMParam,
payload: &[u8],
ns_table: impl IntoIterator<Item = Range<usize>>,
) -> Result<NsAvidMCommit, VidError>
pub fn commit( param: &NsAvidMParam, payload: &[u8], ns_table: impl IntoIterator<Item = Range<usize>>, ) -> Result<NsAvidMCommit, VidError>
Commit to a payload given namespace table. WARN: it assumes that the namespace table is well formed, i.e. ranges are non-overlapping and cover the whole payload.
Sourcepub fn ns_disperse(
param: &NsAvidMParam,
distribution: &[u32],
payload: &[u8],
ns_table: impl IntoIterator<Item = Range<usize>>,
) -> Result<(NsAvidMCommit, Vec<NsAvidMShare>), VidError>
pub fn ns_disperse( param: &NsAvidMParam, distribution: &[u32], payload: &[u8], ns_table: impl IntoIterator<Item = Range<usize>>, ) -> Result<(NsAvidMCommit, Vec<NsAvidMShare>), VidError>
Disperse a payload according to a distribution table and a namespace table. WARN: it assumes that the namespace table is well formed, i.e. ranges are non-overlapping and cover the whole payload.
Verify a namespaced share
Sourcepub fn recover(
param: &NsAvidMParam,
shares: &[NsAvidMShare],
) -> Result<Vec<u8>, VidError>
pub fn recover( param: &NsAvidMParam, shares: &[NsAvidMShare], ) -> Result<Vec<u8>, VidError>
Recover the entire payload from enough share
Sourcepub fn ns_recover(
param: &NsAvidMParam,
ns_id: usize,
shares: &[NsAvidMShare],
) -> Result<Vec<u8>, VidError>
pub fn ns_recover( param: &NsAvidMParam, ns_id: usize, shares: &[NsAvidMShare], ) -> Result<Vec<u8>, VidError>
Recover the payload for a given namespace.
Given namespace ID should be valid for all shares, i.e. ns_commits
and content
have
at least ns_id
elements for all shares.
Source§impl NsAvidMScheme
impl NsAvidMScheme
Sourcepub fn namespace_proof(
param: &AvidMParam,
payload: &[u8],
ns_index: usize,
ns_table: impl IntoIterator<Item = Range<usize>>,
) -> Result<NsProof, VidError>
pub fn namespace_proof( param: &AvidMParam, payload: &[u8], ns_index: usize, ns_table: impl IntoIterator<Item = Range<usize>>, ) -> Result<NsProof, VidError>
Generate a proof of inclusion for a namespace payload.
Sourcepub fn verify_namespace_proof(
param: &AvidMParam,
commit: &NsAvidMCommit,
proof: &NsProof,
) -> Result<Result<(), ()>, VidError>
pub fn verify_namespace_proof( param: &AvidMParam, commit: &NsAvidMCommit, proof: &NsProof, ) -> Result<Result<(), ()>, VidError>
Verify a namespace proof against a namespaced VID commitment.
Auto Trait Implementations§
impl Freeze for NsAvidMScheme
impl RefUnwindSafe for NsAvidMScheme
impl Send for NsAvidMScheme
impl Sync for NsAvidMScheme
impl Unpin for NsAvidMScheme
impl UnwindSafe for NsAvidMScheme
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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