pub struct ComputationDigestSystem<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Producer of ComputationDigest values.
§WARNING: Not a zero-knowledge proof system
prove_computation and
verify_proof exist only to fail loudly: no Sigma protocol,
SNARK or STARK is implemented here. Use
digest_computation and
verify_digest for the integrity digest that is
implemented.
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static> ComputationDigestSystem<T>
impl<T: Float + Debug + Send + Sync + 'static> ComputationDigestSystem<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a digest system.
There is no common reference string: the digest is unkeyed so that anybody holding the inputs and outputs can recompute it.
Sourcepub fn digest_computation(
&self,
input: &Array1<T>,
output: &Array1<T>,
computation: &str,
) -> Result<ComputationDigest<T>>
pub fn digest_computation( &self, input: &Array1<T>, output: &Array1<T>, computation: &str, ) -> Result<ComputationDigest<T>>
Compute the integrity digest of a computation.
Sourcepub fn verify_digest(
&self,
digest: &ComputationDigest<T>,
input: &Array1<T>,
output: &Array1<T>,
computation: &str,
) -> Result<bool>
pub fn verify_digest( &self, digest: &ComputationDigest<T>, input: &Array1<T>, output: &Array1<T>, computation: &str, ) -> Result<bool>
Recompute the digest and compare it with digest.
The verifier must know the inputs and outputs; this is an integrity check, not a proof.
Sourcepub fn prove_computation(
&self,
_input: &Array1<T>,
_output: &Array1<T>,
_computation: &str,
) -> Result<ComputationDigest<T>>
pub fn prove_computation( &self, _input: &Array1<T>, _output: &Array1<T>, _computation: &str, ) -> Result<ComputationDigest<T>>
Always fails: no zero-knowledge proof system is implemented.
Sourcepub fn verify_proof(&self, _digest: &ComputationDigest<T>) -> Result<bool>
pub fn verify_proof(&self, _digest: &ComputationDigest<T>) -> Result<bool>
Always fails: no zero-knowledge proof system is implemented.
The previous implementation returned true whenever the proof bytes were
non-empty and the verification key matched a public constant, so any caller
could forge an accepting proof.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ComputationDigestSystem<T>
impl<T> RefUnwindSafe for ComputationDigestSystem<T>where
T: RefUnwindSafe,
impl<T> Send for ComputationDigestSystem<T>
impl<T> Sync for ComputationDigestSystem<T>
impl<T> Unpin for ComputationDigestSystem<T>where
T: Unpin,
impl<T> UnsafeUnpin for ComputationDigestSystem<T>
impl<T> UnwindSafe for ComputationDigestSystem<T>where
T: UnwindSafe,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.