Struct chain_crypto::algorithms::zkps::dleq::Zkp
source · pub struct Zkp {
challenge: Scalar,
response: Scalar,
}
Expand description
Proof of correct decryption. Note: if the goal is to reduce the size of a proof, it is better to store the challenge and the response. If on the other hand we want to allow for batch verification of proofs, we should store the announcements and the response.
Fields§
§challenge: Scalar
§response: Scalar
Implementations§
source§impl Zkp
impl Zkp
pub const BYTES_LEN: usize = 64usize
sourcepub fn generate<R>(
base_1: &GroupElement,
base_2: &GroupElement,
point_1: &GroupElement,
point_2: &GroupElement,
dlog: &Scalar,
rng: &mut R
) -> Selfwhere
R: CryptoRng + RngCore,
pub fn generate<R>( base_1: &GroupElement, base_2: &GroupElement, point_1: &GroupElement, point_2: &GroupElement, dlog: &Scalar, rng: &mut R ) -> Selfwhere R: CryptoRng + RngCore,
Generate a DLEQ proof
sourcepub fn verify(
&self,
base_1: &GroupElement,
base_2: &GroupElement,
point_1: &GroupElement,
point_2: &GroupElement
) -> bool
pub fn verify( &self, base_1: &GroupElement, base_2: &GroupElement, point_1: &GroupElement, point_2: &GroupElement ) -> bool
Verify a DLEQ proof
pub fn to_bytes(&self) -> [u8; 64]
pub fn write_to_bytes(&self, output: &mut [u8])
pub fn from_bytes(slice: &[u8]) -> Option<Self>
Trait Implementations§
impl Eq for Zkp
impl StructuralEq for Zkp
impl StructuralPartialEq for Zkp
Auto Trait Implementations§
impl RefUnwindSafe for Zkp
impl Send for Zkp
impl Sync for Zkp
impl Unpin for Zkp
impl UnwindSafe for Zkp
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
Mutably borrows from an owned value. Read more