pub struct NsAvidmGf2Scheme;Expand description
Dummy struct for namespaced AvidmGf2 scheme
Implementations§
Source§impl NsAvidmGf2Scheme
impl NsAvidmGf2Scheme
Sourcepub fn setup(
recovery_threshold: usize,
total_weights: usize,
) -> Result<NsAvidmGf2Param, VidError>
pub fn setup( recovery_threshold: usize, total_weights: usize, ) -> Result<NsAvidmGf2Param, VidError>
Setup an instance for AVID-M scheme
Sourcepub fn commit(
param: &NsAvidmGf2Param,
payload: &[u8],
ns_table: impl IntoIterator<Item = Range<usize>>,
) -> Result<(NsAvidmGf2Commit, NsAvidmGf2Common), VidError>
pub fn commit( param: &NsAvidmGf2Param, payload: &[u8], ns_table: impl IntoIterator<Item = Range<usize>>, ) -> Result<(NsAvidmGf2Commit, NsAvidmGf2Common), 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: &NsAvidmGf2Param,
distribution: &[u32],
payload: &[u8],
ns_table: impl IntoIterator<Item = Range<usize>>,
) -> Result<(NsAvidmGf2Commit, NsAvidmGf2Common, Vec<NsAvidmGf2Share>), VidError>
pub fn ns_disperse( param: &NsAvidmGf2Param, distribution: &[u32], payload: &[u8], ns_table: impl IntoIterator<Item = Range<usize>>, ) -> Result<(NsAvidmGf2Commit, NsAvidmGf2Common, Vec<NsAvidmGf2Share>), 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(
common: &NsAvidmGf2Common,
shares: &[NsAvidmGf2Share],
) -> Result<Vec<u8>, VidError>
pub fn recover( common: &NsAvidmGf2Common, shares: &[NsAvidmGf2Share], ) -> Result<Vec<u8>, VidError>
Recover the entire payload from enough share
Sourcepub fn ns_recover(
common: &NsAvidmGf2Common,
ns_index: usize,
shares: &[NsAvidmGf2Share],
) -> Result<Vec<u8>, VidError>
pub fn ns_recover( common: &NsAvidmGf2Common, ns_index: usize, shares: &[NsAvidmGf2Share], ) -> 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_index elements for all shares.
Source§impl NsAvidmGf2Scheme
impl NsAvidmGf2Scheme
Sourcepub fn namespace_proof(
common: &NsAvidmGf2Common,
payload: &[u8],
ns_index: usize,
) -> Result<NsProof, VidError>
pub fn namespace_proof( common: &NsAvidmGf2Common, payload: &[u8], ns_index: usize, ) -> Result<NsProof, VidError>
Generate a proof of inclusion for a namespace payload.
Sourcepub fn verify_namespace_proof(
commit: &NsAvidmGf2Commit,
common: &NsAvidmGf2Common,
proof: &NsProof,
) -> Result<Result<(), ()>, VidError>
pub fn verify_namespace_proof( commit: &NsAvidmGf2Commit, common: &NsAvidmGf2Common, proof: &NsProof, ) -> Result<Result<(), ()>, VidError>
Verify a namespace proof against a namespaced VID commitment.
Auto Trait Implementations§
impl Freeze for NsAvidmGf2Scheme
impl RefUnwindSafe for NsAvidmGf2Scheme
impl Send for NsAvidmGf2Scheme
impl Sync for NsAvidmGf2Scheme
impl Unpin for NsAvidmGf2Scheme
impl UnwindSafe for NsAvidmGf2Scheme
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