Struct solana_zk_token_sdk::encryption::elgamal::ElGamalCiphertext
source · [−]pub struct ElGamalCiphertext {
pub commitment: PedersenCommitment,
pub handle: DecryptHandle,
}
Expand description
Ciphertext for the ElGamal encryption scheme.
Fields
commitment: PedersenCommitment
handle: DecryptHandle
Implementations
sourceimpl ElGamalCiphertext
impl ElGamalCiphertext
pub fn add_amount<T: Into<Scalar>>(&self, amount: T) -> Self
pub fn subtract_amount<T: Into<Scalar>>(&self, amount: T) -> Self
pub fn to_bytes(&self) -> [u8; 64]
pub fn from_bytes(bytes: &[u8]) -> Option<ElGamalCiphertext>
sourcepub fn decrypt(&self, secret: &ElGamalSecretKey) -> DiscreteLog
pub fn decrypt(&self, secret: &ElGamalSecretKey) -> DiscreteLog
Decrypts the ciphertext using an ElGamal secret key.
The output of this function is of type DiscreteLog
. To recover, the originally encrypted
message, use DiscreteLog::decode
.
sourcepub fn decrypt_u32(&self, secret: &ElGamalSecretKey) -> Option<u64>
pub fn decrypt_u32(&self, secret: &ElGamalSecretKey) -> Option<u64>
Decrypts the ciphertext using an ElGamal secret key interpretting the message as type u32
.
Trait Implementations
sourceimpl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
+
operator.sourcefn add(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
+
operation. Read moresourceimpl<'b> Add<&'b ElGamalCiphertext> for ElGamalCiphertext
impl<'b> Add<&'b ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
+
operator.sourcefn add(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
+
operation. Read moresourceimpl<'a> Add<ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a> Add<ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
+
operator.sourcefn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
+
operation. Read moresourceimpl Add<ElGamalCiphertext> for ElGamalCiphertext
impl Add<ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
+
operator.sourcefn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn add(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
+
operation. Read moresourceimpl Clone for ElGamalCiphertext
impl Clone for ElGamalCiphertext
sourcefn clone(&self) -> ElGamalCiphertext
fn clone(&self) -> ElGamalCiphertext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ElGamalCiphertext
impl Debug for ElGamalCiphertext
sourceimpl Default for ElGamalCiphertext
impl Default for ElGamalCiphertext
sourcefn default() -> ElGamalCiphertext
fn default() -> ElGamalCiphertext
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for ElGamalCiphertext
impl<'de> Deserialize<'de> for ElGamalCiphertext
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for ElGamalCiphertext
impl Display for ElGamalCiphertext
sourceimpl From<ElGamalCiphertext> for ElGamalCiphertext
impl From<ElGamalCiphertext> for ElGamalCiphertext
sourcefn from(ct: ElGamalCiphertext) -> Self
fn from(ct: ElGamalCiphertext) -> Self
Converts to this type from the input type.
sourceimpl<'a, 'b> Mul<&'b ElGamalCiphertext> for &'a Scalar
impl<'a, 'b> Mul<&'b ElGamalCiphertext> for &'a Scalar
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn mul(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl<'b> Mul<&'b ElGamalCiphertext> for Scalar
impl<'b> Mul<&'b ElGamalCiphertext> for Scalar
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn mul(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext
impl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, scalar: &'b Scalar) -> ElGamalCiphertext
fn mul(self, scalar: &'b Scalar) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl<'b> Mul<&'b Scalar> for ElGamalCiphertext
impl<'b> Mul<&'b Scalar> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: &'b Scalar) -> ElGamalCiphertext
fn mul(self, rhs: &'b Scalar) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl<'a> Mul<ElGamalCiphertext> for &'a Scalar
impl<'a> Mul<ElGamalCiphertext> for &'a Scalar
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn mul(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl Mul<ElGamalCiphertext> for Scalar
impl Mul<ElGamalCiphertext> for Scalar
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn mul(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl<'a> Mul<Scalar> for &'a ElGamalCiphertext
impl<'a> Mul<Scalar> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: Scalar) -> ElGamalCiphertext
fn mul(self, rhs: Scalar) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl Mul<Scalar> for ElGamalCiphertext
impl Mul<Scalar> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
*
operator.sourcefn mul(self, rhs: Scalar) -> ElGamalCiphertext
fn mul(self, rhs: Scalar) -> ElGamalCiphertext
Performs the
*
operation. Read moresourceimpl PartialEq<ElGamalCiphertext> for ElGamalCiphertext
impl PartialEq<ElGamalCiphertext> for ElGamalCiphertext
sourcefn eq(&self, other: &ElGamalCiphertext) -> bool
fn eq(&self, other: &ElGamalCiphertext) -> bool
sourceimpl Serialize for ElGamalCiphertext
impl Serialize for ElGamalCiphertext
sourceimpl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
-
operator.sourcefn sub(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
-
operation. Read moresourceimpl<'b> Sub<&'b ElGamalCiphertext> for ElGamalCiphertext
impl<'b> Sub<&'b ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
-
operator.sourcefn sub(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: &'b ElGamalCiphertext) -> ElGamalCiphertext
Performs the
-
operation. Read moresourceimpl<'a> Sub<ElGamalCiphertext> for &'a ElGamalCiphertext
impl<'a> Sub<ElGamalCiphertext> for &'a ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
-
operator.sourcefn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
-
operation. Read moresourceimpl Sub<ElGamalCiphertext> for ElGamalCiphertext
impl Sub<ElGamalCiphertext> for ElGamalCiphertext
type Output = ElGamalCiphertext
type Output = ElGamalCiphertext
The resulting type after applying the
-
operator.sourcefn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
fn sub(self, rhs: ElGamalCiphertext) -> ElGamalCiphertext
Performs the
-
operation. Read moresourceimpl TryFrom<ElGamalCiphertext> for ElGamalCiphertext
impl TryFrom<ElGamalCiphertext> for ElGamalCiphertext
type Error = ProofError
type Error = ProofError
The type returned in the event of a conversion error.
sourcefn try_from(ct: ElGamalCiphertext) -> Result<Self, Self::Error>
fn try_from(ct: ElGamalCiphertext) -> Result<Self, Self::Error>
Performs the conversion.
impl Copy for ElGamalCiphertext
impl Eq for ElGamalCiphertext
impl StructuralEq for ElGamalCiphertext
impl StructuralPartialEq for ElGamalCiphertext
Auto Trait Implementations
impl RefUnwindSafe for ElGamalCiphertext
impl Send for ElGamalCiphertext
impl Sync for ElGamalCiphertext
impl Unpin for ElGamalCiphertext
impl UnwindSafe for ElGamalCiphertext
Blanket Implementations
impl<T> AbiEnumVisitor for Twhere
T: Serialize + AbiExample + ?Sized,
impl<T> AbiEnumVisitor for Twhere
T: Serialize + AbiExample + ?Sized,
default fn visit_for_abi(
&self,
digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiEnumVisitor for Twhere
T: Serialize + ?Sized,
impl<T> AbiEnumVisitor for Twhere
T: Serialize + ?Sized,
default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more